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

What is the difference between public and private data members?

930


What will happen if a pointer is deleted twice?

971


What is an arraylist c++?

944


Differentiate between a constructor and a destructor in c++.

809


What is the difference between the compiler and the preprocessor?

884


List the types of polymorphism in c++?

865


Must accepts "Maestro Cards" Tax for bike should be less than 15 Total number of lanes is more than 10 Must provides monthly pass Write a method: boolean isGoodTollBridge(String[] cardsAccepted, String[] tollTax, boolean hasMonthlyPass, int numberOfLanes); String[] cardsAccepted A String array of names of card types accepted for payment of toll tax, it can be null if the toll does not accept any card String[] tollTax A String array of toll tax chart (say “Train : 300”,”BullCart : 10”) boolean hasMonthlyPass This parameter defines whether there is any monthly pass available or not int numberOfLanes This parameter defines the number of lanes for each side

3270


Why Pointers are not used in C++?

845


What is a down cast?

887


Describe protected access specifiers?

931


What is the difference between a reference and a pointer?

846


Write a program to find the Fibonacci series recursively.

862


Which one is a preferred language C or C++? Why?

855


What does the following code do: int c=0; cout< a) Undefined *Updated* b) 01 c) 00

853


What is iomanip c++?

834