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

Describe delete operator?

818


how to access grid view row?

1981


Define a nested class. Explain how it can be useful.

831


Explain operator overloading.

802


What is static function? Explain with an example

796


When are exception objects created?

781


Which recursive sorting technique always makes recursive calls to sort subarrays that are about half size of the original array?

793


Explain about vectors in c ++?

773


What is private inheritance?

825


Are there interfaces in c++?

740


Is map sorted c++?

719


What is a .lib file in c++?

748


How many types of modularization are there in c++?

769


Where the memory to the static variables is allocated?

759


Can turbo c++ run c program?

812