让我们假设我的类没有明确的复制构造函数.是否可以禁止为此类分配或复制对象的操作?例如:
class A
{
// data, methods, but no copy constructor and no overloaded assignment operator
};
A object1;
A object2;
object1 = object2; // make compiler error here
A object3 = object1; // or here
Run Code Online (Sandbox Code Playgroud)