+ 3
STATIC DATA MEMBERS- A static member is shared by all objects of the class. All static data is initialized to zero when the first object is created, if no other initialization is present. We can't put it in the class definition but it can be initialized outside the class as done in the following example by redeclaring the static variable, using the scope resolution operator :: to identify which class it belongs to. STATIC MEMBER FUNCTIONS- By declaring a function member as static, you make it independent of any particular object of the class. A static member function can be called even if no objects of the class exist and the staticfunctions are accessed using only the class name and the scope resolution operator ::.
14th Mar 2018, 2:01 PM
Ratnesh Mishra
Ratnesh Mishra - avatar