what is difference between static and non-static variables

Answer Posted / daxini

Static :
A static variable is defined for the class itself and exists independently of any object of that class.
non-static:
a non static variable is defined for object of the class thus it is bound to an instance of its class

Is This Answer Correct ?    10 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a Program to find the largest of 4 no using macros.

578


What are maps in c++?

502


What is time h in c++?

585


Explain the concept of copy constructor?

615


Implement stack operations with pointers with appropriate exception checks.

567






Difference between struct and class in terms of access modifier.

695


What is virtual function? Explain with an example

583


Explain the difference between overloading and overriding?

609


What is the cout in c++?

549


What are destructors?

571


Is map ordered c++?

592


Can a Structure contain a Pointer to itself?

608


What is type of 'this' pointer? Explain when it is get created?

587


Is c++ a float?

604


What are the rules for naming an identifier?

559