📄 4-1.txt
字号:
#include <iostream.h>
class base{ //基类
int x;
public:
void setx(int n){x=n;}
void showx(){cout<<x<<endl;}
};
class derived:private base{ //私有派生类
int y;
public:
void setxy(int n,int m)
{ setx(n);
y=m;
}
void showxy()
{ cout<<x<<y<<endl; //?
}
};
void main()
{
derived obj;
obj.setxy(10,20);
obj.showxy();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -