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

Are strings immutable in c++?

926


If a function doesn’t return a value, how do you declare the function?

833


What problems might the following macro bring to the application?

822


What things would you remember while making an interface?

792


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

794


What are default parameters? How are they evaluated in c++ function?

922


What is the type of 'this' pointer? When does it get created?

750


What are the four main data types?

830


How do you clear a buffer in c++?

748


Is c++ a good first language to learn?

792


What is the copy-and-swap idiom?

844


What is a class template in c++?

817


Why we use #include conio h in c++?

816


What is array in c++ pdf?

805


Write my own zero-argument manipulator that should work same as hex?

828