Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

C++ Language/Objects/ConstMembers/ConstMemberFunctions

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

A member function automatically has access to a this pointer variable whose type is CRType* and which is automatically pointing at the CRType object being manipulated by this member function. But you could have defined the member function as void CRType::DoAction() const {body}, in which case the type of this becomes const CRType* (that function's body can view data members but not alter them). This restriction can be ignored for individual data members (on a case-by-case basis) but marking the data member with mutable. Additional information about const member functions