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 At :: hcl
 Question Submitted By :: saroj
I also faced this Question!!    
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
 
explain sub-type and sub class? atleast u have differ it into 4 points? 662
what is different between oops and c++ 619
How Do you Code Composition and Aggregation in C++ ? 17619
#include <string.h> #include <stdio.h> #include <stdlib.h> #include<conio.h> void insert(char *items, int count); int main(void) { char s[255]; printf("Enter a string:"); gets(s); insert(s, strlen(s)); printf("The sorted string is: %s.\n", s); getch(); return 0; } void insert(char *items, int count) { register int a, b; char t; for(a=1; a < count; ++a) { t = items[a]; for(b=a-1; (b >= 0) && (t < items[b]); b--) items[b+1] = items[b]; items[b+1] = t; } } design an algorithm for Insertion Sort 501
Templates mean 378
C#.net Interview Question A=10 B=5 C=A+B Print C The above will be given in a multiline textbox. You need to parse the above input, store values for A,B&c. And you have to display the value of C. 2170
define oops concept with example 462
can we make game by using c 1014
any one please tell me the purpose of operator overloading 713
write a program to find 2 power of a 5digit number with out using big int and exponent ? 436
what are the realtime excercises in C++? 1036
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 512
How to use CMutex, CSemaphore in VC++ MFC 1921
design a c++ class for the chess board,provide a c++ class definition for such class(only class definition is required) 3495
What is debug class?what is trace class? What differences are between them? With examples. 413
E-Mail New Answers        Answer Selected Questions