M
Michael
Hi All,
why does this:
class Base {
protected:
int var;
public:
Base():var(0){};
virtual int getVar() = 0;
};
class Class1 : public Base{
protected:
int otherVar;
public:
Class1()therVar(1){};
Class1(int i = 0)therVar(i){};
int getOtherVar(){return otherVar;}
int getVar(){return var;}
};
give me an error:
error: call of overloaded `Class1()' is ambiguous
note: candidates are: Class1::Class1(int)
note: Class1::Class1()
I only have a single constructor that takes an int as a parameter, and a
default that takes no argument. Where is the ambiguity?
Thanks for your help.
Regards
Michael
why does this:
class Base {
protected:
int var;
public:
Base():var(0){};
virtual int getVar() = 0;
};
class Class1 : public Base{
protected:
int otherVar;
public:
Class1()therVar(1){};
Class1(int i = 0)therVar(i){};
int getOtherVar(){return otherVar;}
int getVar(){return var;}
};
give me an error:
error: call of overloaded `Class1()' is ambiguous
note: candidates are: Class1::Class1(int)
note: Class1::Class1()
I only have a single constructor that takes an int as a parameter, and a
default that takes no argument. Where is the ambiguity?
Thanks for your help.
Regards
Michael