题目
#include "stdafx.h"
#include
using namespace std;
class date
{
public:
date(int oa=1):a(oa){}
int a;
};
date &operator=(date &d1,date d2)
{
d1.a=d2.a;
return d1;
}
/*
这里,我不想把operator=写作class date的成员,但却出现了错误
*/
int _tmain(int argc,_TCHAR* argv[])
{
date d1,d2(7);
d1=d2;
cout
#include
using namespace std;
class date
{
public:
date(int oa=1):a(oa){}
int a;
};
date &operator=(date &d1,date d2)
{
d1.a=d2.a;
return d1;
}
/*
这里,我不想把operator=写作class date的成员,但却出现了错误
*/
int _tmain(int argc,_TCHAR* argv[])
{
date d1,d2(7);
d1=d2;
cout
提问时间:2021-03-10
答案
看第3条:基本规则1.一元操作符可以是不带参数的成员函数[1]或带一个参数的非成员函数[1].2.二元操作符可以是带一个参数的成员函数[1]或带两个参数的非成员函数[1].3.operator=、operator[]、operator()、operator->...
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
最新试题
热门考点
- 1CAD制图在一圆中,一直径为斜边,两条直角边长度比为2:1,要画此三角形,大家有什么好的方法吗?
- 2对孙权劝学文章内容分析不正确的是
- 3甲、乙、丙三人共同出资筹建一个公司.甲投资额是投资总额的40%,乙投资额比投资总额的三分之一多20万元,丙投资额比甲的一半少8万元.这个公司投资总额是多少万元?
- 4“今天晚上”的英语,
- 5数学帮一帮:两条直线相交一个交点,三条直线相交3个交点,4条直线相交6个交点.你能发现什么规律吗
- 6一个质量为m=5kg的物块静止在水平面上,物块与地面间的动摩擦因素为μ=0.4
- 7一冰块放在一杯盐水中,若冰块全部溶化后,杯中液面将____(上升、下降、不变)
- 8小明口袋里有一张一元钱,一张五角钱两张一角钱小明随便拿出其中三张,可能的钱的总数是多少?
- 9x2-2x+2分解因式
- 10I like to take adventure的同一句