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
Define immutable object?
Explain how hashmap works?
Is upper case in java?
Are arrays primitive data types?
How to sort list of list in java?
which is advanced deep technology in java launched by the sun microsystem??? The answer is very logical If u need correct answer mail me at priya_gupta@gmail.com
What is the difference between Java and C++?
What is thread pool in java with example?
What is the difference between a synchronized method and a synchronized block?
What are constants?
Explain creating threads by implementing runnable class?
What is a instance variable in java?
What is the difference between preemptive scheduling and time slicing?
If a class is declared without any access modifiers, where can the class be accessed?
What is the default value of local and global variables?