the job of marked const here is to make the member function "operator=" as
const so it can't modify any member function values unless that member
function is mutable

@manikanta
the compiler will throw an error only when we try to modify any members
inside a const member function but here we are not modifying anything thus
no error would be there.

On Mon, May 28, 2012 at 12:50 AM, Lucifer <[email protected]> wrote:

> @amrit
> Every non-static member function of a class has an implicit parameter
> that is passed to the function (when called) This implicit parameter
> is nothing but the "this" pointer. Now if you want to make the
> implicit parameter ("this" pointer) a "const", how would u do it? This
> is done by placing the "const" keyword at the end of the function
> signature.
>
> In case you want to make the "this" pointer "volatile", u can do so by
> placing the keyword "volatile" at the end of the function signature.
>
>
> On May 28, 12:05 am, Manikanta Babu <[email protected]> wrote:
> > 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 throws an error here.
> >
> > Thanks
> > Mani
> >
> > On Mon, May 28, 2012 at 12:23 AM, amrit harry <[email protected]
> >wrote:
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > > 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
> > >https://groups.google.com/d/msg/algogeeks/-/zjDLCIDr_p8J.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected].
> > > For more options, visit this group at
> > >http://groups.google.com/group/algogeeks?hl=en.
> >
> > --
> > Thanks & Regards,
> > Manihttp://www.sanidapa.com- The music Search engine
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
regards,
Bhaskar Kushwaha
Student
CSE
Third year
M.N.N.I.T.  Allahabad

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to