Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef __LAB11_EMPLOYEES_H_INCLUDED
- #define __LAB11_EMPLOYEES_H_INCLUDED
- #include <iostream>
- #include <stdint.h>
- using namespace std;
- class Employee{
- public:
- Employee(char * name, int32_t salary);
- Employee();
- ~Employee();
- virtual int salary() const = 0;
- virtual ostream& output(ostream &st) = 0;
- virtual ofstream& output(ofstream &st) = 0;
- virtual istream& input(istream &st) = 0;
- virtual ifstream& input(ifstream &st) = 0;
- friend std::ostream& operator<<(ostream &st, Employee &e);
- friend std::ofstream& operator<<(ofstream &st, Employee &e);
- friend std::istream& operator>>(istream &st, Employee &e);
- friend std::ifstream& operator>>(ifstream &st, Employee &e);
- private:
- char *_name;
- int32_t _base_salary;
- };
- class Developer: public Employee {
- public:
- Developer(char*, int32_t, bool);
- Developer();
- ostream& output(ostream &st);
- istream& input(istream &st);
- ofstream& output(ofstream &st);
- ifstream& input(ifstream &st);
- int salary() const {
- int salary = _base_salary;
- if (_has_bonus) { salary += 1000; }
- return salary;
- }
- private:
- Developer(const Developer&){};
- Developer& operator=(const Developer& link){return *this;};
- char *_name;
- int32_t _base_salary;
- bool _has_bonus;
- };
- class SalesManager: public Employee {
- public:
- SalesManager(char* , int32_t, int32_t, int32_t);
- SalesManager();
- ostream& output(ostream &st);
- istream& input(istream &st);
- ofstream& output(ofstream &st);
- ifstream& input(ifstream &st);
- int salary() const {
- return _base_salary + _sold_nm * _price * 0.01;
- }
- private:
- SalesManager(const SalesManager&){};
- SalesManager& operator=(const SalesManager &link){return *this;};
- char *_name;
- int32_t _base_salary;
- int32_t _sold_nm, _price;
- };
- class EmployeesArray {
- public:
- EmployeesArray(int32_t);
- ~EmployeesArray();
- friend std::ostream& operator<<(ostream &os, EmployeesArray &e);
- friend std::ofstream& operator<<(ofstream &os, EmployeesArray &e);
- friend std::ifstream& operator>>(ifstream &os, EmployeesArray &e);
- std::ostream& outar(ostream &os);
- std::ofstream& outar(ofstream &os);
- std::ifstream& outar(ifstream &os);
- void add(const Employee *e);
- int total_salary() const;
- private:
- Employee **_employees;
- int32_t sz;
- int32_t capacity;
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement