就是随便写也出错呀!
#include<iostream>
#include<string>
using namespace std;
class employee
{
public:
employee(string nam,char s,int a)
protected:
string name;
char sex;
int age;
};
class workerhours:public employee
{
public:
workerhours(string nam,char s,int a,float w):employee(nam,s,a),wage(w){}
void show()
{
cout<<"name"<<name<<endl;
cout<<"age"<<age<<endl;
cout<<"sex"<<sex<<endl;
cout<<"wage"<<wage<<endl;
}
protected:
float wage;
};
int main()
{
workerhour worker1("zhangsan","f",21,8)
worker1.show();
return 0;
}
你也随便写呀
就是要个完整的呀