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
Explain hashset and its features?
What is sorting algorithm in java?
define the terminology association.
What is the largest long allowed by java?
What are some examples of variable costs?
Why are functions called methods in java?
Can we synchronize static methods in java?
What is the longest unicode character?
Why charat is used in java?
What happens to a static var that is defined within a method of a class?
What are structs in java?
Differences between external iteration and internal iteration?
What is the primitive type short?
What is double word?
What is the purpose of the enableevents() method?