First of all, I apologize if there is another publication that answers this, all similar entries that I found related to diamond inheritance schemes or certain functions, which is not there.
In short, I wonder if it is possible to inherit one class from two other classes, where both child classes have a function with the same name and arguments, but it is defined in one child class and pure-virtual in another. Also, if I can do this, will call a function in a pure-virtual / abstract class end up calling a specific function on another child class with minimal changes to the derived class?
Example:
class A { public: virtual void Set(int X) = 0; }; class B { public: virtual void Set(int X); }; class AB : public A, public B {
So far, my attempts to compile this basic example have been completed with errors that say:
'AB': it is not possible to instantiate an abstract class for the following members: 'void A :: Set (int)': abstract
When I conducted my own research, I could not find a clear answer, but, based on other questions that related to topics, I found that using this “use of B :: Set” in class AB can help with this. But when I try to add it to the AB class definition, the error persists.
Is there any way to do this?
source share