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

program for insertion ,deletion,sorting in double link list

2686


write a C++ program for booking using constructor and destructor.

2542


What are the 5 oop principles?

1123


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

1136


Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)

2105


what type of question are asked in thoughtworks pair programming round ?

2215


write a program to enter a string like"sunil is a good boy and seeking for a job" not more than 10 characters including space in one line,rest characters should b in other line.if the next line starts from in between the previous word,then print whole word to next line.

2243


Can abstract class have normal methods?

1050


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

2164


I have One image (means a group photo ) how to split the faces only from the image?............ please send the answer nagadurgaraju@gmail.com thanks in advace...

2112


What type of loop is a for loop?

1091


Can a destructor be called directly?

1076


How does polymorphism work?

1138


Which language is not a true object oriented programming language?

1135


Which method cannot be overridden?

1093