#include<iostream>
using namespace std;
class Salary
{
public:
Salary(int n);
Salary(Salary &s);
~Salary();
void get_salary();
void show_salary();
private:
double *salary;
int number;
};
Salary::Salary(int n)
{
number=n;
salary=new double[number];
}
Salary::Salary(Salary &s)
{
number=s.number;
salary=new double[number];
for(int i=0;i<number;i++)
*(salary+i)=*(s.salary+i);
}
Salary::~Salary()
{
delete []salary;
}
void Salary::get_salary()
{
cout<<"请输入职工工资:";
for(int i=0;i<number;i++)
cin>>*(salary+i);
}
void Salary::show_salary()
{
cout<<"职工工资列表:";
for(int i=0;i<number;i++)
cout<<*(salary+i)<<" ";
cout<<endl;
}
int main()
{
Salary s(10);
s.get_salary();
s.show_salary();
return 0;
}