What is the use of static functions?

Answer Posted / manu

Static member functions have external linkage. These
functions do not have this pointers. As a result,

They cannot access nonstatic class member data using
the member-selection operators (. or –>).

They cannot be declared as virtual.

They cannot have the same name as a nonstatic function
that has the same argument types.

They are useful as they donot have access to this pointer
and so they can be called even though the class is not
instantiated.

Is This Answer Correct ?    10 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are smart pointers?

1236


If dog is a friend of boy and boy is a friend of house, is dog a friend of house?

763


How can I learn c++ easily?

842


What happens if a pointer is deleted twice?

1034


Why is standard template library used?

797


What is meant by forward referencing and when should it be used?

782


What are c++ storage classes?

812


Describe protected access specifiers?

912


What is the difference between passing by reference and passing a reference?

787


What is the need of a destructor?

871


What are stacks? Give an example where they are useful.

781


Difference between delete and free.

831


When one must use recursion function? Mention what happens when recursion functions are declared inline?

885


What is an orthogonal base class in c++?

883


What is using namespace std in cpp?

766