How is static data member similar to a global variable?



How is static data member similar to a global variable?..

Answer / Jeetendra Kumar Pandey

Static data members are similar to global variables because they have a lifetime for as long as the program runs, and they can be accessed from anywhere within their scope. However, static data members belong to a specific class, while global variables do not.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

What are the different types of variables in C++?

1 Answers  


What happens if a pointer is deleted twice?

1 Answers   Flextronics,


What problem does the namespace feature solve?

1 Answers  


Is c++ used anymore?

1 Answers  


What is Pure Virtual Function? Why and when it is used ?

10 Answers   Lucent, Sona,


What is meaning of in c++?

1 Answers  


let a,b,c be three integer numbers.write a c++ program with a function void rotate 1()such that a->b->c and c->a.

1 Answers  


how to find the maximum of 10 numbers ?

5 Answers  


Is c++ slower than c?

1 Answers  


What is vectorial capacity?

1 Answers  


How do you generate a random number in c++?

1 Answers  


How can a called function determine the number of arguments that have been passed to it?

1 Answers  


Categories