aqueel
January 28th, 2005, 09:03 AM
If I have
class Base1 {
public:
int myFunc();
};
class Base2 {
public:
void myFunc();
};
class Derived: public Base1, // Derived doesn't declare
public Base2 { // a function called doIt
...
};
Derived d;
d.myFunc(); // error! — ambiguous
That fine No probs
but when I have
class Base1 {
public:
int myFunc();
};
class Base2 {
private:
void myFunc(); // this function is now
}; // private
class Derived: public Base1, public Base2
{ ... }; // same as above
Derived d;
int i = d.myFunc(); // error! — still ambiguous!
The call to myFunc() continues to be ambiguous, even though only the function in Base1 is accessible!
Why do we have such behaviour??
Thanx for ur response in advance.
class Base1 {
public:
int myFunc();
};
class Base2 {
public:
void myFunc();
};
class Derived: public Base1, // Derived doesn't declare
public Base2 { // a function called doIt
...
};
Derived d;
d.myFunc(); // error! — ambiguous
That fine No probs
but when I have
class Base1 {
public:
int myFunc();
};
class Base2 {
private:
void myFunc(); // this function is now
}; // private
class Derived: public Base1, public Base2
{ ... }; // same as above
Derived d;
int i = d.myFunc(); // error! — still ambiguous!
The call to myFunc() continues to be ambiguous, even though only the function in Base1 is accessible!
Why do we have such behaviour??
Thanx for ur response in advance.