Ну, можно сделать что-то такое:
#include <iostream>
using namespace std;
class StrangeClass
{
public:
StrangeClass(const StrangeClass& other) = delete;
StrangeClass(const StrangeClass&& other) = delete;
StrangeClass& operator =(const StrangeClass& other) = delete;
StrangeClass& operator =(const StrangeClass&& other) = delete;
static StrangeClass* getNewInstance()
{
return new StrangeClass;
}
private:
StrangeClass()
{
// do something
}
};
int main() {
// StrangeClass c1; // it isn't compiled
// StrangeClass *c2 = new StrangeClass; // it also isn't compiled
StrangeClass *c3 = StrangeClass::getNewInstance();
delete c3;
return 0;
}
Только зачем?