C++ Parent class calling a child virtual function

前端 未结 7 869
半阙折子戏
半阙折子戏 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条回答
  • 2021-02-13 23:28

    Alternatively, make a factory method for creating the objects and make the constructors private, the factory method can then Initialize the object after construction.

    0 讨论(0)
提交回复
热议问题