64,647
社区成员
发帖
与我相关
我的任务
分享
#include<iostream>
#include<fstream>
using namespace std;
class base
{
public:
base(int x = 100) {
a = x;
}
base &operator=(const base& temp) {
this->a = temp.a;
return *this;
}
private:
int a;
};
class der : public base
{
public:
der(int x = 1000) : base(x) {
b = x;
}
der &operator=(const der& temp) {
base::operator =(temp);
this->b = temp.b;
return *this;
}
private:
int b;
};
int main()
{
der a;
der b(111);
a = b;
}
base::operator =(temp);