Interaction with shape through another class



  • I need to at the end of the game to decorate the reboot of the game, which is at the heart of the picture, and then another interaction with the shape is possible. Is it right to transfer the TGameForm class to Controller? I just don't know how to do anything about it. Java would have written a bunch of interfaces and redesigned in Controller, but I can't do that here.

    What kind of solution can you offer?

    class TMainForm : public TForm, public IListener
    

    When attempting multiple inheritance with TForm class, a mistake is made:

    IListener is not abstract public single inheritance class hierarchy with no data

    Abstract class code:

    class IListener {
    public:
        virtual ~IListener() {
        }
        virtual void Update()=0;
    };
    

    Интерфейс: кнопка перезагрузки



  • The point is, in my abstract class IListener, there was a trainer, and for multiple inheritance with VCL classes, it is necessary that the abstract class contain only virtual functions and nothing more.

    class IListener {
    public:
        virtual void UpdateData()=0;
    };
    

    P.S. The specific virtual function of the Update is already used in the VCL contrasts, so it replaced UpdateData() for full compatibility.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2