complex_number const operator =(complex_number temp) const
{
return *this;
}
what is the job of marked 'const'???
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
const allows this function to be called on constant object.
So if someone creates an const obj of this class. Assignments can be done.
On Mon, May 28, 2012 at 12:23 AM, amrit harry dabbcomput...@gmail.comwrote:
complex_number const operator =(complex_number temp) const
{
return
Its a const member function, you cant return reference to the object.
Const member function never allows you to modify the data until unless its
a mutable. So here we are passing the reference to object which is
modifiable, it conflicts with the const member function property.
So the compiler