Can string be an overloaded operator

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lovecreatesbea...@gmail.com

    Can string be an overloaded operator

    How can ``string'' and ``time_t'' be operator functions in the link
    below? The two names are not keywords and not shown in the standard in
    sec 13.5p1.

    Thank you for your time.

    <quote>


    00048 class MYSQLPP_EXPORT DateTime : public Comparable<Date Time>
    00049 {

    ....

    00165 operator std::string() const;
    00166
    00168 operator time_t() const;

    ....
    </quote>
  • Senthil

    #2
    Re: Can string be an overloaded operator

    On Aug 19, 12:06 pm, "lovecreatesbea ...@gmail.com"
    <lovecreatesbea ...@gmail.comwr ote:
    How can ``string'' and ``time_t'' be operator functions in the link
    below? The two names are not keywords and not shown in the standard in
    sec 13.5p1.
    >
    Thank you for your time.
    >
    <quote>http://www.tangentsoft.net/mysql++/d...time_8h-source...
    >
    00048 class MYSQLPP_EXPORT DateTime : public Comparable<Date Time>
    00049 {
    >
    ...
    >
    00165         operator std::string() const;
    00166
    00168         operator time_t() const;
    >
    ...
    </quote>
    This is a typical example of a conversion operator..

    A member function X::operator T(), is a conversion operator where T is
    any type name and X is the class name and it defines the conversion
    from X to T.

    Best Regards,
    Senthil

    Comment

    Working...