28 lines
661 B
C++
28 lines
661 B
C++
|
|
#ifndef EXAMPLE10_COMPANY_H
|
|
#define EXAMPLE10_COMPANY_H
|
|
|
|
#include <iostream>
|
|
#include "Employee.h"
|
|
|
|
class Company {
|
|
private:
|
|
std::string name;
|
|
Employee* ptrEmployee; // aggregation
|
|
public:
|
|
Company(std::string cname, Employee* ename) : name(cname), ptrEmployee(ename) {
|
|
std::cout << "Company::constructor" << std::endl;
|
|
}
|
|
virtual ~Company() {
|
|
std::cout << "Company::destructor" << std::endl;
|
|
}
|
|
virtual const std::string& toString() const {
|
|
return name;
|
|
};
|
|
virtual void employed() const {
|
|
std::cout << ptrEmployee->toString();
|
|
}
|
|
};
|
|
|
|
#endif //EXAMPLE10_COMPANY_H
|