This preview shows pages 1–2. Sign up to view the full content.
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
This note was uploaded on 03/15/2010 for the course STATISTIC 472 taught by Professor Amjad during the Spring '08 term at Yarmouk University.
- Spring '08