Hi Coders,
I was just trying out a simple singleton class. I have wriiten the below code.
Now My que is : How do I instantiate the class from main function. PLS HELP :)
class MOV{
private:static MOV* inst;
MOV(){cout<<"Hellooooooo\n"<<endl;}
public:static MOV* get_it(){
if(!inst){
MOV *p=new MOV;
cout<<"1st instance creted..\n"<<endl;
return p;
}
else {
cout<<"Already Instance exists....so Try Agian\n"<<endl; }
}
};
int main()
{
MOV *s;
MOV *t;
???????/* how to cretae instances */
???????
t=MOV::get_it(); /* complier error*/
return -3;
}