"TIME SMART STUDY" में आप सभी का स्वागत है
TODAY TOPIC — STATIC DATA MEMBER
STATIC DATA MEMBER—
Static data member class का global variable होता है, जिसको कोई भी object access कर सकता है।
A static data Member of a class is just like a global variables for this class. That is, this data member is globally available for all the objects of that class type. The static data Member are usually maintained to store values comman to the entire class.
HOW TO CREATE STATIC DATA MEMBERS
(I) Declaration within the class definition with static keyword.
(II) Definition outside the class definition.
class X
{ static int count; // declaration within the class
:
};
The definition of the above declared static Member count outside the class will be as follows:
int X::count;
A static data Member can be given an initial value at the time of it's definition.
int x::count=0;
NOTE
- एक class में एक से ज्यादा variable हो सकते हैं
- Static एक class का नाम है।
- Static member function वैसे जो static member को access कर सकते हैं।
- Same variable लेने के लिए भी static data member बनाते हैं।
आपको ये पोस्ट कैसी लगी हमे कमेंट कर के जरूर बताएं।
Comments
Post a Comment
Please Subscribe and Comments my blog site.