Can overloading is possible with two version of function, constant member function and function with

Posted by GG on Stack Overflow See other posts from Stack Overflow or by GG
Published on 2010-06-16T19:47:50Z Indexed on 2010/06/16 20:02 UTC
Read the original article Hit count: 615

Filed under:
|
|
|

Hello,

I just came across various overloading methods like type of parameter passed, varying number of parameters, return type etc. I just want to know that can I overload a function with following two version


//function which can modify member
String& MyClass::doSomething();

//constant member function
String& MyClass::doSomething() const;

Please let me know the reason behind it.

Thanks, GG

© Stack Overflow or respective owner

Related posts about c++

Related posts about function