Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How many objects are created for a singleton class

Answer Posted / utkarsh verma

c++ program to explain Singleton

class Single {

private:
Single(){} //Can't instantiate

public:
Static Single* Obj;
Static *Single Instance ()
{
if(Obj == NULL)
Obj = new Single();
return Obj;
}
}//End of class

Single * Single ::Obj = NULL;

void main(){

Single *ptr = Obj->Instance(); //The only way to instantiate

}

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the common uses of "this" keyword in java ?

1015


Can you instantiate the math class in Java?

1081


How many bits is a string?

987


What methodology can be utilized to link to a database?

954


What is lambda expression in java?

1031


What do you mean Abstraction in java?

1082


What is the benefit of inner / nested classes ?

984


Differentiate between stringbuffer and string?

1021


What is your platform’s default character encoding?

1077


Why can't we use static class instead of singleton?

933


What is a map in java?

980


What is an abstract class and what is it’s purpose?

953


What is boolean used for?

1018


What is difference between array and arraylist in java?

983


Give an example of use of pointers in java class.

1022