类的赋值运算符和拷贝构造函数

#include<stdio.h>

class A
{
  private:
    const A& operator=(const A&);
};

int main()
{
  A a;
  A b = a;//ok,实际上是A b(a),即调用拷贝构造函数
  A c;
  c = a;//error,因为'='已被声明为私有
  return 0;
}
原文地址:https://www.cnblogs.com/johnsblog/p/3952187.html