/* * intern.cpp * * Created on: 16.05.2013 * Author: trifon */ #include "intern.h" Intern::Intern() : period(3) { cerr << "Intern()" << endl; } Intern::Intern(char const* _name, char const* _id, int _fn, double _grade, char const* _position, double _salary, int _period) : Employee(NULL, NULL, _position, _salary), Student(NULL, NULL, _fn, _grade), Person(_name, _id), period(_period) { cerr << "Intern(...)" << endl; } int Intern::getPeriod() const { return period; } void Intern::setPeriod(int _period) { period = _period; } void Intern::print() const { Person::print(); cout << *this; } Intern::Intern(Intern const& i) : period(i.period), Student(i), Employee(i) { cerr << "copy Intern" << endl; } Intern::~Intern() { cerr << "~Intern()" << endl; } Intern& Intern::operator=(Intern const& i) { if (this != &i) { cerr << "= Intern" << endl; (Student&)*this = i; (Employee&)*this = i; //Student::operator=(i); //Employee::operator=(i); period = i.period; } return *this; } ostream& operator<<(ostream& os, Intern const& i) { os << (Student const&)i; os << (Employee const&)i; os << "Период на стажа: " << i.period << endl; return os; } char const* Intern::getPosition() const { return "Стажант"; } void Intern::setPosition(char const*) { cerr << "Не може да се променя позицията на стажант!" << endl; }