1. Static data members of a class should be defined( it is declared inside the class) outside the class to allocate the storage location.
2. Static member functions are independent of any object of a class.They dont have access to this pointer of a class
3. Static Data Member and member functions are accessed using classname and scope resolution operator(::).
4. A static member function can only access static data members, static member functions and any other functions from outside the class.
5. Static member functions cannot be virtual,volatile,const,const volatile.
6. Static member functions donot have access to non static data members/member functions.The vptr is non static data member , hence static member functions cant access it.
5. Static member functions cannot be virtual,volatile,const,const volatile.
6. Static member functions donot have access to non static data members/member functions.The vptr is non static data member , hence static member functions cant access it.
Please comment if you find anything incorrect or have any other input
No comments:
Post a Comment