i need write new method. following code given:
const class * func() const;
but mean when both class , function declared constant?
const class * func() const;
the const class*
return type. says function returns pointer const class
. whoever calls function receive pointer, can't modify object points at.
the const
@ end of declaration says member function not modify state of object being called on. is, doesn't modify object this
points at. in fact, if try modify data member (that not mutable
) in func
, compiler tell off.
Comments
Post a Comment