I have a class 'D' which has a member function 'play'. Play is supposed to take two parameters, both objects of class 'A'. I have two other classes, 'B' and 'C', which are both inherited (protected) from class 'A'. The way my program is structured, I only have an object of 'B' and another of 'C' to pass to function 'play'. How can I make this work? If I pass these two inherited objects, I get a compiler error:
cannot cast 'B' to its protected base class 'A'
Do I need to cast the objects back to 'A' objects to be able to pass them to 'play'? Or can I somehow use them as is?