Copy constructor needs to call a method that depends on the object, but constructor can't be virtual

后端 未结 6 688
伪装坚强ぢ
伪装坚强ぢ 2021-01-20 19:24

I have an abstract base class with two inherited classes. In both these classes I define a virtual method that is used by the constructor. Now I need to create a copy constr

6条回答
  •  太阳男子
    2021-01-20 20:27

    1. Be careful about calling virtual methods in base class constructors.
    2. You may want to use a clone-method.

提交回复
热议问题