Inheritance Problem - No method to override RRS feed

  • Question

  • User1168746228 posted


    I'm having the following issue and I don't see a way to upload an image without having a URL to it.

    The root class is Player.  It contains a virtual method TakeTurn that needs to be implemented by its two sub-classes HumanPlayer and MachinePlayer.

    MachinePlayer also has two sub-classes with different functionality:  a Client_MachinePlayer, and a Server_MachinePlayer which runs in a web service.  The Server_MachinePlayer needs to implement TakeTurn while the Client_MachinePlayer does not.

    I don't see a way to declare the TakeTurn method in the MachinePlayer class so that it can be overridden by Server_MachinePlayer.TakeTurn.  I can't declare it virtual because you can't have a virtual method inheriting from another virtual method and if I remove it entirely then it says no suitable method found to override.

    Any help would be greatly appreciated.  Thanks.

    Thursday, January 7, 2021 3:02 PM