operator overloading and virtual funtions

R

ravinderthakur

hi all experts,

i was just thinking about making overloaded operators virtual. i was
wordering what could be the
implications of such scenarios.


i will be thankful if somebody can provide point out some general
issues in making overloaded virtual or point me to some resource
having explaination about the same.



thanks
ravinder.
 
B

Bob Hairgrove

hi all experts,

i was just thinking about making overloaded operators virtual. i was
wordering what could be the
implications of such scenarios.


i will be thankful if somebody can provide point out some general
issues in making overloaded virtual or point me to some resource
having explaination about the same.

Have you read the FAQ yet?
http://www.parashift.com/c++-faq-lite/operator-overloading.html

Don't forget that there is a difference between overloading and
overriding. Overloaded functions (or operators) take different
arguments, but they are in the same class or namespace. However,
virtual functions need to be overridden, which means they have to take
the same arguments in the derived class as in the base class. If you
truly overload a virtual function or operator by providing different
arguments, you will likely end up hiding the base class virtual
function or operator.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top