模糊的C ++构造函数行为

时间:2019-05-03 15:48:48

标签: c++

如果不事先声明a,我将无法理解如何调用复制构造函数。

我知道复制构造函数接受A的引用,但我不了解如何初始化该引用。

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <string>
class A {
   public:
    A() = delete;
    A(A&) = default;
    void operator = (A&) {}
  private:
    int x;
};
int main()
{
    A a(a);
}

0 个答案:

没有答案
相关问题