C++ Parent class calling a child virtual function

前端 未结 7 897
半阙折子戏
半阙折子戏 2021-02-13 22:34

I want a pure virtual parent class to call a child implementation of a function like so:

class parent
{
  public:
    void Read() { //read stuff }
    virtual vo         


        
7条回答
  •  旧时难觅i
    2021-02-13 23:17

    With one step more you could just introduce some kind of a function like

    class parent
    {
        public:
            void initialize() {
                read();
                process();
            }
    }
    

提交回复
热议问题