Hello, I am wondering what would be the appropriate way to go about this:
I am making a class which can be initialized with either an int or a string. I also want the constructor to initialize some member variables. This looks like this:
1 2 3 4 5 6 7 8 9
class Some_Class {
private:
int member1;
int member2;
public:
Some_Class(std::string arg) : member1(10), member2(20) {}
Some_Class(int arg) : member1(10), member2(20) {}
};
This should be correct but it seems redundant. Is there a more appropriate way to do this?