36 lines
821 B
C
36 lines
821 B
C
|
#include <string>
|
||
|
#include <vector>
|
||
|
#include <iostream>
|
||
|
using namespace std;
|
||
|
|
||
|
class Employee
|
||
|
{
|
||
|
public:
|
||
|
Employee(string name, string department, int salary)
|
||
|
{
|
||
|
this->name = name;
|
||
|
this->department = department;
|
||
|
this->salary = salary;
|
||
|
cout << "Employee name: " + name << ", department: " + department << ", salary: " << salary << endl;
|
||
|
}
|
||
|
void add(Employee *employee)
|
||
|
{
|
||
|
vector.push_back(employee);
|
||
|
}
|
||
|
std::vector<Employee*> getVector()
|
||
|
{
|
||
|
return this->vector;
|
||
|
}
|
||
|
string getDetails()
|
||
|
{
|
||
|
string ret = "Employee name: " + name + ", department: " + department + ", salary: " + std::to_string(salary);
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
|
private:
|
||
|
string name;
|
||
|
string department;
|
||
|
int salary;
|
||
|
std::vector<Employee *> vector;
|
||
|
};
|