Base Copy constructor not called

前端 未结 6 1982
悲&欢浪女
悲&欢浪女 2021-02-10 07:44
class Base
{
      public:
      int i;

      Base()
      {
          cout<<\"Base Constructor\"<

        
6条回答
  •  暖寄归人
    2021-02-10 08:16

    In your Derived copy constructor, you need to add the following:

    Derived (const Derived &d) : Base(d) { }
    

提交回复
热议问题