NH> NH> static int CClassName::MethodName( int SomeVar )
NH> TM> Are you sure it looked exactly like this?
NH> Not _exactly_ like that - I changed the names to make my point more
NH> obvious. The "static int", however, _are_ exactly as they were in t
NH> original.
Ok, then it looked like this:
//class declaration:
class CClassName
{
// stuff
static int MethodName(int SomeVar);
// other stuff
};
//class definition:
int CClassName::MethodName(int SomeVar)
{
// implementation stuff
}
Here static tells you that MethodName() is a class method rather than
an instance method.
NH> TM> The keyword "static" is used for two purposes in C++.
NH> TM> 1. in class declarations to declare class methods/attributes.
NH> TM> 2. in implementation files to prevent the name of a function/
NH> TM> variable/constant from polluting the global namespace.
NH> I think maybe there are three, as can be seen by the replies I've
NH> already gotten.
No, these are the two possibilities. It's just the wording that is
different.
Thomas
---
þ MM 1.0 #0113 þ Don't abbrev.
--- PCBoard (R) v15.22/M 25
---------------
* Origin: McMeier & Son BBS (2:301/138)
|