what is a ststic variable and stiticfunction
briefly explain with exmple and in which case we use

Answer Posted / subhashish sen

When a variable is declared with static keyword,its called
as static variable,means it retains its value across
different function calls.Its basically used for counting no
of objects created for a class in C++ and its initialized to
0 by default.

When a function declared as static,its called as static
function.It can only operate on static variables.

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is polymorphism used?

573


What is inheritance in oop?

591


What is methods in oop?

531


What is class in oop with example?

608


What is and I oop mean?

607






What is protected in oop?

596


Why it is called runtime polymorphism?

569


What is an interface in oop?

585


What are the components of marker interface?

592


What is abstract class in oops?

588


Is enum a class?

596


What is the use of oops?

609


What are constructors in oop?

581


What is the difference between abstraction and polymorphism?

604


Why do while loop is used?

568