当前位置: > #include "stdafx.h"...
题目
#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

提问时间: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的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
版权所有 CopyRight © 2012-2019 超级试练试题库 All Rights Reserved.