11 Classes [class]

11.4 Class members [class.mem]

11.4.3 Non-static member functions [class.mfct.non.static]

A non-static member function may be called for an object of its class type, or for an object of a class derived ([class.derived]) from its class type, using the class member access syntax ([expr.ref], [over.match.call]).
A non-static member function may also be called directly using the function call syntax ([expr.call], [over.match.call]) from within its class or a class derived from its class, or a member thereof, as described below.
When an id-expression ([expr.prim.id]) that is neither part of a class member access syntax ([expr.ref]) nor the unparenthesized operand of the unary & operator ([expr.unary.op]) is used where the current class is X ([expr.prim.this]), if name lookup ([basic.lookup]) resolves the name in the id-expression to a non-static non-type member of some class C, and if either the id-expression is potentially evaluated or C is X or a base class of X, the id-expression is transformed into a class member access expression ([expr.ref]) using (*this) as the postfix-expression to the left of the . operator.
[Note 1: 
If C is not X or a base class of X, the class member access expression is ill-formed.
— end note]
This transformation does not apply in the template definition context ([temp.dep.type]).
[Example 1: struct tnode { char tword[20]; int count; tnode* left; tnode* right; void set(const char*, tnode* l, tnode* r); }; void tnode::set(const char* w, tnode* l, tnode* r) { count = strlen(w)+1; if (sizeof(tword)<=count) perror("tnode string too long"); strcpy(tword,w); left = l; right = r; } void f(tnode n1, tnode n2) { n1.set("abc",&n2,0); n2.set("def",0,0); }
In the body of the member function tnode​::​set, the member names tword, count, left, and right refer to members of the object for which the function is called.
Thus, in the call n1.set("abc",&n2,0), tword refers to n1.tword, and in the call n2.set("def",0,0), it refers to n2.tword.
The functions strlen, perror, and strcpy are not members of the class tnode and should be declared elsewhere.93
— end example]
[Note 2: 
An implicit object member function can be declared with cv-qualifiers, which affect the type of the this pointer ([expr.prim.this]), and/or a ref-qualifier ([dcl.fct]); both affect overload resolution ([over.match.funcs]).
— end note]
An implicit object member function may be declared virtual ([class.virtual]) or pure virtual ([class.abstract]).
93)93)
See, for example, <cstring>.