what do you mean by static member variable?
Answers were Sorted based on User's Feedback
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 |
Answer / bhaskar
when static member variable executed that variable value is
automatically assigns to zero....
| Is This Answer Correct ? | 4 Yes | 3 No |
how to swap the variables without using temp and operators
what is polymorphism?
Can destructor be overloaded?
what is opps?why it is use in programming language?
c++ provides classes...and classes do what we want but why then strcut are used...if we say data hiding... it is also provided by c++ in structs then why to prefer clasess
Differences between inline functions and non-inline functions?
why reinterpret cast is considered dangerous?
What is encapsulation oop?
Give an example where we have to specifically use C programming language and C++ programming language cannot be used?
What is a linked list?
char* ptr = "Rahul"; *ptr++; printf("%s",ptr); What will be the output
Please tell me the oops concept with detailed answer