1.

Solve : C++ inheritence ambiguous?

Answer»

Hi fellas.

I am making a program using C++ OOP and am having problems with inheritance.
Simply I want...

class CObject1
class CObject2 : public CObject1
class CObject3 : public CObject1, CObject2

The problem is that when I call something like SetPointA(###); it says it is ambiguous. What does this mean and how can I resolve it without uninheriting anything?

Thanks and let me know if you need any more info.



EDIT: Ok figured it out. Just deleted CObject1 from CObject3. It still gets EVERYTHING threw CObject2.
Thanks anyways.I'm not a C++ programmer but I do Java and C# programming. From what I recall you can't inherit from more than ONE class. You can only inherit multiple interfaces.Quote from: ultimatum on April 02, 2011, 08:51:35 PM

I'm not a C++ programmer but I do Java and C# programming. From what I recall you can't inherit from more than one class. You can only inherit multiple interfaces.

C++ supports multiple inheritance. The reason Boozu's attempts were ambiguous was because it was inheriting the members of CObject1 twice.I'm surprised anyone replied at all after my edit. I find that this happens to me a lot were I ask a question then the answer comes to me.


Discussion

No Comment Found