If you are using C ++ 11 or later, you can use the keyword finalas mentioned in another answer. And this should be the recommended solution.
, ++ 03/++ 98, private factory.
class A {
private:
A(int i, int j) : a(i), b(j) {}
friend A* create_A(int i, int j);
};
A* create_A(int i, int j) {
return new A(i, j);
}