What is the use of static functions?

Answer Posted / reejusri

Static function is basically used in creating factory
objects.
You can make your constructor private and expose static
function. And user can use the static methods to create the
object of that class.
Using NONSHARABLE_CLASS you can restrict the usage of
static functions/method also.

Is This Answer Correct ?    15 Yes 16 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a responder chain?

573


Explain container class.

687


What is the difference between a baller and a reference in C++?

577


Write a program to interchange 2 variables without using the third one.

588


What are keywords in c++?

600






Why cstdlib is used in c++?

585


Is java a c++?

563


what is scupper?

1895


Explain unexpected() function?

584


What is the function to call to turn an ascii string into a long?

597


Will c++ be replaced?

553


Describe the syntax of single inheritance in C++?

645


What are exceptions c++?

594


What are the two main components of c++?

591


What is a pointer how and when is it used?

576