Here is my problem. I would like to have a class with a private constructor that can be created with more than one static method, exactly like Box.createHorizontalBox(). Where it gets complicated is w
Trying to learn something new every day I\'d be interested if the following is good or bad design. I\'m implementing a class A that caches objects of itself in a static private member variable std::m
If I don\'t want to allow anyone to create an instance of my class except for my static functions (I think this is called singleton/factory?), is it enough to make the default constructor private, or
I would like to call a static method from a class that I\'ll determine at run-time, but which I know subclasses a given class.So let\'s say I have these classes
This question already has answers here: Closed 12 years ago. Possible Duplicate: How to use a object whose copy constructor and copy assignment is private?
We can restrict the creation of object of a class by making its constructor private. But this constructor could still be called from within the class.
Yet another qu开发者_StackOverflow中文版estion, go me!... Anyway, I have 2 classes with private constructors and static functions to return an instance of that class.