Static Member Functions in C++

Like static member variable, we can also have static member functions. A member function that is declared static just place a static keyword before the function header. Syntax: Characteristics of Static Member function: Static member functions are associated with a class, not with any object. They can be invoked using class name, not object. They can access only static members of the class. They cannot be virtual. They cannot be declared as constant or volatile. A static member function can be called, even when a class is not instantiated.   …

Read More

Static Data Member in C++

A data member of a class can be qualified as static . The properties of a static member variable are similar to that of a static variable. A static member variable has contain special characteristics. static variable characteristics: It is initialized to zero when the first object of its class is created.No other initialization is permitted. Only one copy of that member is created for the entire class and is shared by all the objects of that class, no matter how many objects are created. It is visible only with…

Read More