Meditation, The Art of Exploitation

Thinking? At last I have discovered it--thought; this alone is inseparable from me. I am, I exist--that is certain. But for how long? For as long as I am thinking. For it could be, that were I totally to cease from thinking, I should totally cease to exist....I am, then, in the strict sense only a thing that thinks.

Sunday, March 05, 2006

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)

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.