Live example for static function?

Answer Posted / sachinmundhra

Live Example for static function is Singleton class.

Static Method is used and called to get the instance of
class.

class Base
(
private:
Base()
public:
static Base* GetObject() // This is a static method
};

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What c++ is used for?

583


When should I use unitbuf flag?

588


What is using namespace std in cpp?

547


How c functions prevents rework and therefore saves the programers time as wel as length of the code ?

622


What is class definition in c++ ?

627






How do you define/declare constants in c++?

609


What are special characters c++?

564


What is ios flag in c++?

682


total amount of milk produced each morning and then calculates and outputs the number of cartons needed for this milk , the cost of producing the milk and the profit from producing this milk.

2081


What is ostream in c++?

572


What is pure virtual function?

626


What is == in programming?

614


What are the benefits of c++?

569


What is std :: flush?

576


What is the maximum value of a unsigned char a) 255 b) 256 c) 128

633