正在加载图片...
9.1概述 运算符重载约定:关于单个对象的运算 将运算符函数重载为普通函数(C函数)时, 参数中至少要有一个类或类的引用类型: int operator+(int,A); 正确 int operator+-(const A&,int);/正确 不能将重载运算符函数的参数类型定义为 对象指针(简单类型)或者对象数组类型; int operator+(A *int); /错误 int operator+(A[6],int); 1/错误 1111 9.1 概述 ™运算符重载约定:关于单个对象的运算 )将运算符函数重载为普通函数(C函数)时, 参数中至少要有一个类或类的引用类型; int operator+(int, A); //正确 int operator+(const A&, int); //正确 )不能将重载运算符函数的参数类型定义为 对象指针(简单类型)或者对象数组类型; int operator+(A *, int); //错误 int operator+(A[6], int); //错误
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有