fertig mit aufgabe 7
This commit is contained in:
parent
5c0724bea0
commit
f434fb7a3d
@ -1,6 +1,9 @@
|
||||
#include "Klavier.h"
|
||||
#include "Musikinstrument.h"
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
Klavier::Klavier() { cout << "Konstruktor: Klavier()" << endl; }
|
||||
Klavier::Klavier() : Musikinstrument("Klavier") {
|
||||
cout << "Konstruktor: Klavier()" << endl;
|
||||
}
|
||||
Klavier::~Klavier() { cout << "Destruktor: ~Klavier()" << endl; }
|
||||
void Klavier::spielen() const { cout << "Klavier klimpert" << endl; }
|
||||
|
||||
@ -10,7 +10,7 @@ Musiker::Musiker(string name) {
|
||||
cout << "Konstruktor: Musiker(string name): " << name << endl;
|
||||
}
|
||||
Musiker::~Musiker() {
|
||||
cout << "Destruktor: ~Musiker()" << endl;
|
||||
cout << "Destruktor: ~Musiker() : " << name << endl;
|
||||
delete this->instrument;
|
||||
}
|
||||
string Musiker::liefereName() { return name; }
|
||||
@ -20,4 +20,5 @@ void Musiker::spielen() const {
|
||||
}
|
||||
void Musiker::weiseInstrumentZu(Musikinstrument const *instrument) {
|
||||
this->instrument = instrument;
|
||||
cout << name << " erhält " << instrument->liefereName() << endl;
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
using namespace std;
|
||||
|
||||
Musikinstrument::Musikinstrument() {
|
||||
this->name = "Irgendein Musikinstrument";
|
||||
cout << "Konstruktor: Musikinstrument()" << endl;
|
||||
}
|
||||
Musikinstrument::Musikinstrument(string name) {
|
||||
@ -10,7 +11,7 @@ Musikinstrument::Musikinstrument(string name) {
|
||||
cout << "Konstruktor: Musikinstrument(string name): " << name << endl;
|
||||
}
|
||||
Musikinstrument::~Musikinstrument() {
|
||||
cout << "Destruktor: Irgentein Musikinstrument" << endl;
|
||||
cout << "Destruktor: ~Musikinstrument : " << name << endl;
|
||||
}
|
||||
void Musikinstrument::spielen() const {
|
||||
cout << "Irgentein Musikinstrument erklingt irgentwie" << endl;
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
#include "Musikinstrument.h"
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
Trompete::Trompete() {
|
||||
Musikinstrument("Trompete");
|
||||
cout << "Konstruktor: Trompete()" << endl; }
|
||||
Trompete::Trompete() : Musikinstrument("Trompete") {
|
||||
cout << "Konstruktor: Trompete()" << endl;
|
||||
}
|
||||
Trompete::~Trompete() { cout << "Destruktor: ~Trompete()" << endl; }
|
||||
void Trompete::spielen() const { cout << "Trompete trötet" << endl; }
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user