Class hierarchy and polymorphismus
worker.cpp
Go to the documentation of this file.
1
#include "
worker.h
"
2
#include <iostream>
3
#include <string>
4
using namespace
std;
5
6
Worker::Worker
(
const
string
& name,
float
hours,
float
wageHours)
7
:
Employee
(name), _hours(hours),_wageHours(wageHours)
8
{
9
//ctor
10
}
11
12
Worker::~Worker
()
13
{
14
//dtor
15
}
16
17
void
Worker::print
(ostream& s)
const
18
{
19
Employee::print
(s);
20
// s << "Lohn: " << payment() << endl; // dank virtueller Methode payment() nicht mehr noetig
21
}
Employee
Definition:
employee.h:9
Employee::print
virtual void print(std::ostream &s) const
Definition:
employee.cpp:22
Worker::~Worker
~Worker() override
Definition:
worker.cpp:12
Worker::Worker
Worker(const std::string &name, float hours, float wageHours)
Worker::print
void print(std::ostream &s) const override
Definition:
worker.cpp:17
worker.h
worker.cpp
Generated by
1.9.1