-
constructor overloading
hi I'm learning c++ from a book , now I'm trying to solve an exercise that you need to use overload constructors, here is my code actually it works fine but I need to know if it is the right way to do it.
please excuse my poor english.
Code:
class MyClass{
public:
MyClass(char *); //constructor 1
MyClass(int *); //constructor 2
MyClass(float *); //constructor 3
//rest of code here, etc...
};
-
should work. Whether it is the best way to do it depends on the rest of the class.
-
Well it's legal, but without knowing what MyClass is being used for I can't tell if it's the right thing to do.
-
ok, thanks
I really only need to know if its legal,
thanks for the reply