Just put your setup method in the default constructor, and if you need to call that in any other constructor; use a constructor initialization list:
class myclass{
public:
myclass(){ std::cout << "setup part" << std::endl; }
myclass(int x): myclass(){ /* calls myclass() first */ }
};
int main(int argc, char *argv[]){
myclass c0; // prints "setup part"
myclass c1{5}; // also prints "setup part"
}
This is the most idiomatic way to do it.
If you need delayed initialization; I like to use a tagged constructor and an init method:
struct no_init_tag{};
no_init_tag no_init;
class myclass{
public:
myclass(int x){ init(x); }
myclass(no_init_tag){}
void init(int arg){ std::cout << "init with " << arg << std::endl; }
};
int main(int argc, char *argv[]){
myclass c0{5}; // prints "init with 5"
myclass c1{no_init}; // doesn't print
int n = 0;
// set 'n' somehow
c1.init(n); // prints "init with " then 'n'
}
This makes it so that using dynamic memory for delayed initialization isn't required, but could still be done.