Base Copy constructor not called

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

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

        
6条回答
  •  天命终不由人
    2021-02-10 08:16

    C++ doesn't do any kind of "constructor matching". If you do not explicitly call the base class constructor, the default one is called (well, technically, the base class subobject is "value initialized", but for classes with constructors this is the same thing).

提交回复
热议问题