C++ Overridden method not getting called

后端 未结 8 1374
逝去的感伤
逝去的感伤 2021-02-13 11:20

Shape.h

namespace Graphics {
    class Shape {
    public:
        virtual void Render(Point point) {};
    };
}

Rect.h

namespa         


        
8条回答
  •  春和景丽
    2021-02-13 11:38

    The polymorphism will only work from a pointer to a shape, not from a shape object.

提交回复
热议问题