?? person.cpp
字號:
#include <iostream.h>
class Person {
private:
char name[19];
int age;
char unit[30];
public:
void InputData() {
cout << "請輸入姓名,年齡,工作部門:";
cin >> name >> age >> unit;
}
void DisplayData() {
cout << "姓名:"<<name<<",年齡:"<<age<<",工作部門:"<<unit;
}
};
class Employee:public Person {
private:
char phone[15];
public:
void InputData() {
Person::InputData();
cout << "請輸入電話號碼:";
cin >> phone;
}
void DisplayData() {
Person::DisplayData();
cout << ",電話號碼:"<<phone<<endl;
}
};
void main() {
Employee em;
em.InputData();
cout << endl << "結果顯示:" << endl << endl;
em.DisplayData();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -