Advertisements
Advertisements
प्रश्न
Differentiate between static data members and non-static data members.
अंतर स्पष्ट करें
उत्तर
S. No. | Static data member | Non-static/Ordinary data member |
1. | All class objects share a single copy of this variable. | Each item creates a copy of the data. |
2. | It can be accessed without requiring an instance of the class. | Using it requires first constructing a class instance. |
3. | Static variables are allocated only once during class loading. | Each new object creates additional memory allocations for these variables. |
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?