This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: data member. • If a function of a class is static, in the class definition it is declared using the keyword static in its heading. • If a data member of a class is static, it is declared using the keyword static. • A static member function or data of a class can be accessed either by the object name or by using the class name and the scope resolution operator (if the member is public). ClassName::StaticVariableName; ClassName::StaticFunctionName( ); 1 • Static data member (private or public) initialized as follows(usually at file scope): DataType ClassName::StaticVariableName = InitialValue; • In the definition of a static member function, you cannot use non-static data member or a non-static function unless there is an object declared locally that accesses the non-static data member or the non-static member function. • Every object of a class maintains a hidden pointer to itself, and the name of this pointer is this. • Static member function has no this pointer. 2...
View Full Document
- Spring '08
- Object-Oriented Programming, Subroutine, Programming constructs