C++ how to declare a function in a class
I found the following exerpt from "The C++ programming language" 3rd edition insightful,
11.5 Friends [over.friends]
An ordinary member function declaration specifies three logically distinct things:
1. The function can access the private part of the class declaration, and
2. the function is in the scope of the class, and
3. the function must be invoked on an object (has a this pointer)
11.5 Friends [over.friends]
An ordinary member function declaration specifies three logically distinct things:
1. The function can access the private part of the class declaration, and
2. the function is in the scope of the class, and
3. the function must be invoked on an object (has a this pointer)
By declaraing a member function static, we can give it the first two properties only; by declaraing a function a friend, we give it the first property only.
<< Home