Child of child of Abstract class

I have an abstract Base Class A that has some normal virtual functions and some pure virtual functions.

Class B : Class A (but in this class there is not any use of A's virtual functions)

Class C : Class B (in this class I want to re-implement A's normal virtual functions and pure virtual functions)

Will I have to declare all the virtual functions of A in B in order to access them in C?
Will I also have to give them a dummy implementation in B?

Such an arrangement may seem wierd but the implementation is:
A is a graphics item.
B is a control element to be used as a graphics item.
C,D,E... are specific control elements like push buttons, MCBs etc.
Will I have to declare all the virtual functions of A in B in order to access them in C?

No. You don't need to declare them in B just so that they can be implemented in C.

Will I have to declare all the virtual functions of A in B in order to access them in C?

You need them to be implemented in a class when you instantiate that class. If you ever want to instantiate an object of type B, then you'll need definitions in B. Otherwise, you won't need them in B.

Such an arrangement may seem wierd but the implementation is:
A is a graphics item.
B is a control element to be used as a graphics item.
C,D,E... are specific control elements like push buttons, MCBs etc.

That's not weird - that's pretty normal for a GUI framework. That's how things like Qt or WxWidgets will do things.

Last edited on
Thank you MikeyBoy, that clarifies my doubt.
Topic archived. No new replies allowed.