TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: NEIL HELLER
from: THOMAS MAEDER
date: 1997-03-27 09:26:00
subject: STATIC? SAY WHAT?

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)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.