473,382 Members | 1,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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>
http://www.tangentsoft.net/mysql++/d...8h-source.html

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

....

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

....
</quote>
Aug 19 '08 #1
1 1289
On Aug 19, 12:06*pm, "lovecreatesbea...@gmail.com"
<lovecreatesbea...@gmail.comwrote:
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<DateTime>
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
Aug 19 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Nitin Bhardwaj | last post by:
Thanx in advance for the response... I wanna enquire ( as it is asked many a times in Interviews that i face as an Engg PostGraduate ) about the overloading capability of the C++ Language. ...
5
by: Andy Jarrell | last post by:
I'm trying to inherit from a specific class that has an overloaded operator. The problem I'm getting is that certain overloaded operators don't seem to come with the inheritance. For example: ...
2
by: Andrew | last post by:
I have written two classes : a String Class based on the book " C++ in 21 days " and a GenericIpClass listed below : file GenericStringClass.h // Generic String class
14
by: ambar.shome | last post by:
Hi, As you know there are few operators in C++ which cant be overloaded. They are: .., .*, ::, ?: , new , delete , sizeof , typeid , static_casr , dynamic_cast , const_cast ,...
1
by: Alex Zhitlenok | last post by:
Hi, My question is how to resolve in C# ambiguous overloaded operators? Let say, I have two unrelated classes A and B, each one implements overloaded operator + with the first parameter of type...
6
by: tommaso.gastaldi | last post by:
Hi, does anybody know a speedy analog of IsNumeric() to check for strings/chars. I would like to check if an Object can be treated as a string before using a Cstr(), clearly avoiding the time...
17
by: Dinsdale | last post by:
I would like to compare a string value to a pre-determined list of other strings. Is there a simple way to do this in one statements like this: if(strMystring.ToUpper() == ("STRING1"| "STRING2"|...
26
by: Neville Lang | last post by:
Hi all, I am having a memory blank at the moment. I have been writing in C# for a number of years and now need to do something in VB.NET, so forgive me such a primitive question. In C#, I...
5
by: raylopez99 | last post by:
I need an example of a managed overloaded assignment operator for a reference class, so I can equate two classes A1 and A2, say called ARefClass, in this manner: A1=A2;. For some strange reason...
2
by: subramanian100in | last post by:
overloaded operator=() -------------------------------- overloaded assignment operator should be a non-static MEMBER function of a class. This ensures that the first operand is an lvalue. If...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.