ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories >> Software >> Programming-Languages >> C++ >> C++-General
 
 
 
Question
What is the use of static functions?
 Question Submitted By :: Shalini
I also faced this Question!!     Rank Answer Posted By  
 
Answer
The differences between a static member function and non-
static member functions are as follows.

A static member function can access only static member 
data, static member functions and data and functions 
outside the class. A non-static member function can access 
all of the above including the static data member.

A static member function can be called, even when a class 
is not instantiated, a non-static member function can be 
called only after instantiating the class as an object.

A static member function cannot be declared virtual, 
whereas a non-static member functions can be declared as 
virtual

A static member function cannot have access to the 'this' 
pointer of the class.
The static member functions are not used very frequently in 
programs. But nevertheless, they become useful whenever we 
need to have functions which are accessible even when the 
class is not instantiated.
 
0
V Venkatesh
 
View All Answers
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com