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 is meant by bytecode?

1077


What are the two categories of data types in the java programming language?

1032


How do I get a substring?

1032


Difference between ‘is-a’ and ‘has-a’ relationship in java?

1041


What is split return?

1082


How will you call an Applet using Java Script Function?

1085


Does treeset use compareto?

1021


How the metacharacters are different from the ordinary characters?

1064


Why we use set in java?

1037


java program with complete 4 oops concepts implemented example

3210


Explain 5 io best practices?

1081


Can an interface be defined inside a class?

1105


Explain thread in java?

1230


What is a line break?

1073


What is a constructor overloading in java?

1098