ALLInterview.com :: Home Page
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   Errors
   Testimonials Refer this Site  Refer This Site to Your Friends  Site Map  Contact Us      
   
 
Categories >> Software >> Programming Languages >> C++ >> OOPS
 


   

 

Question what is a ststic variable and stiticfunction
briefly explain with exmple and in which case we use
 Question Asked In Companies :: HCL,     < I also faced this Question! >
 Question Submitted By :: saroj
  Answer Posted By  
 
Answer
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


 
  subhashish sen
 
View All Answers
 
 
Please Help Members By Posting Answers For Below Questions
 
 Question Views   Select
 
What is the renewal class? 1052
write a program that takes input in digits and display the result in words from 1 to 1000 868
write a program to find 2^n+1 ? 456
Write a program to sort the number with different sorts in one program ?? 803
what are the different types of qualifier in java? 669
Write a program to compute for numeric grades for a course. The course records are in a file that will serve as the input file. The input file is in exactly the following format: Each line contains a student's first name, then one space, then ten quiz scores all on one line. The quiz scores are in whole number and are separated by one space. Your program will take it input from this file and sends it output to a second file. The data in the output file will be exactly the same as the data in the input file except that there will be one additional number (of type double) at the end of each line. This number will be the average of the student's ten quiz scores. Use at least one function that has file streams as all or some of its arguments. 908
Get me a number puzzle game-program 563
Why is it so that we can have virtual constructors but we cannot have virtual destructors? 1671
There are two base class B1,B2 and there is one class D which is derived from both classes, Explain the flow of calling constructors and destructors when an object of derived class is instantiated. 437
can we make game by using c 1365
write a C++ program for booking using constructor and destructor. 910
How to handle exception in c++, For example in a functions i am assigning memory to some variables and also in next instructions in am dividing one variable also. If this functions generates a error while allocating memory to those variable and also while dividing the variable if i divide by zero then catch block how it will identify that this error has cone from perticular instruction 601
to find out the minimum of two integer number of two different classes using friend function 586
i am getting an of the type can not convert int to int *. to overcome this problem what we should do? 604
assume the program must insert 4 elements from the key board and then do the following programs.sequential search(search one of the elements),using insertion sort(sort the element) and using selection sort(sort the element). 625
E-Mail New Answers        Answer Selected Questions