?? person1.cpp
字號:
#include <iostream.h>
#include <string.h>
class Person {
private:
char name[19];
int age;
char unit[30];
public:
Person(char *n, int a, char *u) {
strcpy(name, n);
age = a;
strcpy(unit, u);
}
void DisplayData() {
cout << "姓名:"<<name<<",年齡:"<<age<<",工作部門:"<<unit;
}
};
class Employee:public Person {
private:
char phone[15];
public:
Employee(char *n, int a, char *u, char *p):Person(n, a, u) {
strcpy(phone, p);
}
void DisplayData() {
Person::DisplayData();
cout << ",電話號碼:"<<phone<<endl;
}
};
void main() {
Employee em("張三", 20, "中山大學", "020-84118888");
cout << endl << "結果顯示:" << endl << endl;
em.DisplayData();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -