标签:font .sh alt ext == std 技术分享 ret har
#include<iostream> #include<string> using namespace std; class Person { protected: char sex; int age; string name; public: Person(string nam,char s,int a) { name=nam; sex=s; age=a; } }; class Employee:public Person { private: int salary,leave; public: Employee(string nam,char s,int a,int y,int l):Person(nam,s,a) { salary=y; leave=l; } void show() { cout<<"name"<<":"<<name<<endl; cout<<"age"<<":"<<age<<endl; cout<<"sex"<<":"<<sex<<endl; cout<<"basicSalary"<<":"<<salary<<endl; cout<<"leavedays"<<":"<<leave<<endl; } }; int main() { int a,b,c; char e; string f; cin>>f>>e>>a>>b>>c; Employee t(f,e,a,b,c); t.show(); return 0; }
标签:font .sh alt ext == std 技术分享 ret har
原文地址:http://www.cnblogs.com/lytwajue/p/6786387.html