i have 2 classes, one class which inherits it's parameters from an abstract class:
class Child : public Base {
public:
Child(string s, int i, ) : Base(s, i){};
... // methods
};
and another which has two overloaded constructors, one uses normal parameters and another, gets the same parameters but from the first class' already existing object:
header file:
class Other {
private:
string s;
int i;
Child o;
public:
Other(string str, int num);
Other(Child ob);
};
cpp file:
Other :: Other(string str, int num) : s(str), i(num) {/* this is where the error happens*/};
Other :: Other(Child ob) : o(ob) {
};
but when i try to compile i get an error at the marked place "C2512 'Other': no appropriate default constructor available"
What could be the problem? i really need to to pass that object into the constructor