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 ternary operator?

1018


How is abstraction implemented in java ?

1026


What is the common usage of serialization? What exceptions occur during serialization?

1137


What is meant by memory leak?

1086


What is parsing a string?

1179


Which keyword specify that a variable is effectively final ?

1001


What is java autoboxing?

958


What is identifier give example?

1046


What is the final class modifier?

1049


What is the difference between assignment and initialization?

1056


How do you start a new line in java?

992


How many bits is a double?

1024


Can we have any code between try and catch blocks?

994


Why declare Main() inside the class in java ?

1075


What happens if an exception is throws from an object's constructor?

1139