Base Copy constructor not called

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

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

        
6条回答
  •  南笙
    南笙 (楼主)
    2021-02-10 08:17

    I think you have to explicitly call the base copy constructor:

      Derived (Derived& d) : Base(d)
      {
          cout<<"Derived copy Constructor"<

提交回复
热议问题