C / C++ FAQs & Programming Resources - ProkutFAQ : NonInheritableClass

HomePage Recent Changes Recently Commented Login/Register
Quick Links
Categories
Links
There are different ways to do this as follows (along with their disadvantages):

1. Make all constructors private. You will need to provide public 'interfaces' (static functions) to create objects of the class though.
2. Make the destructor private. You will be unable to create objects of the class on the stack though
3. Make the class a friend of, and inherit the class from a virtual base class whose destructor is private.
 Comments [Hide comments/form]
Page was generated in 0.0202 seconds