First, about stoffel's post and inline functions. An inline function is EITHER a function OR a macro OR BOTH...depending on the compiler's analysis of the situation. The COMPILER looks at HOW much memory is taken up by expanding the code (MACRO), and how much by making it a function and calling it, and it chooses the best option (ideally). It's really simple, and here's some examples of when and where it will choose each.
Ex 1 - When an inline function consists on nothing but a single function call itself, it will ALWAYS be expanded (cause the space for calling a FUNCTION version is equal to the space of EXPANDING it, and expanding it saves the overhead of having the function anywhere in the code.
Ex 2 - When a fairly small function is called only a few times (compiler dependent, but usually around 8) it is expanded.
Ex 3 - When a fairly small function is called MANY times (compiler dependant) it is made into a function and called like all other functions.
Ex 4 - When a LARGE function is called only a few times. This one is compiler dependant. Some analize the situation and choose whichever is more effiecent, some just perform the test for number of uses and if it is below the threashhold they expand it as a macro (never mind the inefficiency of this particualar case).
Hope that helps.
BTW jharler is 100% correct in his post.
about the number of things instantiated - stoffels post is correct except the inline issue (which i addressed above). But I wanted to explain WHY so you would understand it better. A FUNCTION (any function) is STATIC by default, a variable is not. This is why when you want to use a function in another module you don't have to use static on the body, or extern on the prototype, but you do for shared variables. But be VERY carefull...since static behavior is assumed for functions, they made using the static keyword on MEMBER FUNCTION do something else. A STATIC MEMBER FUNCTION is one that can be accessed without an instance of the class (it doesn't pass a 'this' pointer, and it can be called directly).
Example:
class Useless
{
public:
static GetClassName(void) {return "Useless";}
};
in main you can say:
cout << Useless::GetClassName();
and it calls that function directly. There are very few uses for such functions, but there is ONE VERY IMPORTANT ONE...for implementing FACTORIES...a very importan OO design pattern. This allows you to have a class member function that controls creation of instances of the class...pretty neat;