Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: C++ inheritence ambiguous  (Read 3399 times)

0 Members and 1 Guest are viewing this topic.

Boozu

    Topic Starter


    Hopeful

    Thanked: 9
    • Yes
    • Yes
  • Certifications: List
  • Experience: Familiar
  • OS: Windows 10
C++ inheritence ambiguous
« on: March 15, 2011, 01:57:37 AM »
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.
« Last Edit: March 15, 2011, 02:23:11 AM by Boozu »
Don't worry about it.  If it's not good at stock, then it's not good.


ultimatum



    Intermediate
  • Thanked: 3
    Re: C++ inheritence ambiguous
    « Reply #1 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.
    Its not what you know, its what you can do that counts!

    BC_Programmer


      Mastermind
    • Typing is no substitute for thinking.
    • Thanked: 1140
      • Yes
      • Yes
      • BC-Programming.com
    • Certifications: List
    • Computer: Specs
    • Experience: Beginner
    • OS: Windows 11
    Re: C++ inheritence ambiguous
    « Reply #2 on: April 02, 2011, 09:02:00 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 was trying to dereference Null Pointers before it was cool.

    Boozu

      Topic Starter


      Hopeful

      Thanked: 9
      • Yes
      • Yes
    • Certifications: List
    • Experience: Familiar
    • OS: Windows 10
    Re: C++ inheritence ambiguous
    « Reply #3 on: April 02, 2011, 10:13:10 PM »
    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.
    Don't worry about it.  If it's not good at stock, then it's not good.