I found two quotes from the standard:
"5.2.2
For a member function call, the postfix expression shall be an implicit
(9.3.1, 9.4) or explicit class member access (5.2.5) whose idexpression
is
a
function member name, or a pointertomember expression (5.5) selecting a
function member. The first expression in the postfix expression is then
called the object expression, and the call
is as a member of the object pointed to or referred to. In the case of
an
implicit class member access, the
implied object is the one pointed to by this. [Note: a member function
call
of the form f() is interpreted
as (*this).f() (see 9.3.1). ]"
"9.3.1 Nonstatic member functions [class.mfct.nonstatic]
1 A nonstatic member function may be called for an object of its class
type,
or for an object of a class derived
(10) from its class type, using the class member access syntax (5.2.5,
13.3.1.1). A nonstatic member function
may also be called directly using the function call syntax (5.2.2,
13.3.1.1)
- from within the body of a member function of its class or of a class
derived from its class, or
- from a meminitializer
(12.6.2) for a constructor for its class or for a class derived from its
class.
If a nonstatic member function of a class X is called for an object that
is
not of type X, or of a type derived
from X, the behavior is undefined."
Please note the last sentence. It seems clear to me that any nonstatic
member function can *only* be called on an object.
--Yeah, and the function:
--void foo( X&, Y& );
--can only be called on two objects (specifically instances of X and Y).
--What's so special about the member case?
My newsreader not indenting your test , so I've manually marked your text
with --.
You seem confused about the meaning of "calling a member function on an
object".
You give an example of a non member fucntion and then ask .what is so
special about member functions. I don't know where you are coming from ,
do
you know the difference between a member function and non member
function?- Hide quoted text -