-
Junior Member
constructor
hai every body,
how can we create an instance of a class , having the constructor with the private access specifier.........
pls can any body tell me the answer..........
Thanks in Advace ...........
Regads
mallik
-
Junior Member
Re: constructor
The private constructor can be called from a static member of that class. Like:
class ClassA{ ClassA(); public: static void* create(){return new ClassA();}};
Another reason for a private constructor is to hide a default constructor and to force the class user to construct it using a constructor with arguments.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules