Inherits from abstract classes

Soppose to have the following situation:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class IBase {
};

class IA : virtual public IBase {
  virtual void methodA() = 0;
};

class IB {
  virtual void methodB() = 0;
};

class IC : public IA, public IB {
};


class ClassA : public IA {
  void methodA(){...};
};

class ClassC : public IC, public ClassA {
  void methodB(){...};
};

int main()
{
  ClassC ObjC;
};


"Compiling" this pseudo-code I get the error:

ClassC ObjC: "cannot instantiate abstract class due to following members:"

IA::methodA();

Why this happens?
The IA::methodA() is implemented in ClassA and ClassC derives from it, so I expect that calling ClassC::methodA() generates a call to ClassA::methodA()

thanks,
Daniele.
ClassC inheritance:

        ClassC
     IC        ClassA
 IA     IB        IA
IBase            IBase

ClassC is inheriting IA twice non virtually
You're right!

Thanks.
Daniele.
Topic archived. No new replies allowed.