|
-
January 28th, 2005, 10:03 AM
#1
Ambigous!!! But why???
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|