Class member without a default constructor

后端 未结 3 1342
栀梦
栀梦 2020-12-07 02:16

Suppose I have a class A without a default constructor, a factory method factoryA that returns an object of type A, and a class B that has A as its member. I know that in th

3条回答
  •  隐瞒了意图╮
    2020-12-07 02:33

    In this case it's better to use the pointer to A, i.e. A* _a, and then call A constructor wherever you want.

提交回复
热议问题