Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what do you mean by static member variable?

Answer Posted / madhu

In C++ when you declare and define a static variable, it
tells the compiler that only one copy of memory will be
allocated and all the objects of that class will share that
copy.
As we know for class data variables memory will be created
independently for every object of that class. and we can
access the data using object. But, for static variables
memory is created only once for all objects and is no object
is owned the static variable. we can access the static
variable using class name.

Mainly static variables are used when want to count the
objects created and destroyed and when we are dealing with
singleton design pattern.

Is This Answer Correct ?    10 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is overriding in oop?

1096


Write a program to reverse a string using recursive function?

2406


what's the basic's in dot net

2231


write a program to find 2 power of a 5digit number with out using big int and exponent ?

2437


Can bst contain duplicates?

1242


Is this job good for future? can do this job post grduate student?

2219


What is polymorphism used for?

1108


Describe these concepts: Polymorphism, Inheritance and Abstraction.

1245


What is overriding vs overloading?

1109


What are different oops concepts?

1111


How do you use inheritance in unity?

1125


What is the difference between encapsulation and polymorphism?

1153


When not to use object oriented programming?

1176


What is encapsulation and abstraction? How are they implemented in C++?

1184


INSTANCE FIELDS DECLARED private ARE ACCESSIBLE BY THE METHODS ONLY.CAN WE CHANGE THE private FIELD OF AN OBJECT IN A METHOD OF SOME OTHER OBJECT OF THE SAME CLASS?

2249