|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
What is static data members of class? I am beginner in the field of the programming.I don't have sound knowledge about regarding static data members of class. Are Static Members similar to the normal variable or function? How we can define static data members within class? If you have any idea regarding static data members, Please share with us. |
#2
| |||
| |||
Re: What is static data members of class? Only one copy of a Static data member of a class exists, and it is shared within all objects of that particular class. Static data members of the class follow the usual class access rules, except that they can be initialized in scope of the file. Static data members can access other static private as well as protected members of their class. You can define Static data members of any type except void. Example of Static member declaration: Quote:
|
#3
| |||
| |||
Re: What is static data members of class? Classes can contain static member data and Static member functions. When you declare a data member as static, only one copy of the data is maintained for all objects of the class. Static data members are not the part of the objects of a given class type. As a result of this , the declaration of a static data member is not considered as a definition. Static data members have external linkage. The below code shows this: Quote:
|
#4
| |||
| |||
Re: What is static data members of class? Each class template instantiation has its own copy of static data members. Static declaration can be of template argument type or of any the defined type.Please go through following example of the static data members: Quote:
|
![]() |
|
Tags: members of class, static, static data, static data member, static data members, static member, static variables |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Static method in Abstract class | Anthony12 | Software Development | 6 | 12-08-2010 10:22 AM |
What are the Static storage class in C | Garett | Software Development | 3 | 23-01-2010 11:07 AM |
Access the non-public members of the class:C++ | UseME | Software Development | 3 | 18-01-2010 11:23 AM |
Java example for static members | ScarFace 01 | Software Development | 6 | 05-01-2010 05:14 AM |
How to initialize static members in template classes | Aienstaien | Software Development | 3 | 05-05-2009 06:36 PM |