Compare commits
9
Commits
A5
...
69411ac10f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69411ac10f | ||
|
|
e56437fb06 | ||
|
|
3a509f18ed | ||
|
|
529a8606f2 | ||
|
|
187ccdc6a5 | ||
|
|
3e50fa9c4d | ||
|
|
12eaaaa18d | ||
|
|
9f0b35451b | ||
|
|
3b94f5d1b1 |
No files matched your search
@@ -0,0 +1,15 @@
|
||||
# Klassen:
|
||||
- Verkehrsmittel
|
||||
- Posistion (int x, int y)
|
||||
- bewegen(neue Posistion)
|
||||
- text()
|
||||
- Luftfahrzeuge
|
||||
- max. Flughöhe
|
||||
- text()
|
||||
- Radfahrzeuge
|
||||
- Anzahl Räder
|
||||
- text()
|
||||
- Pkw
|
||||
- Anzahl Türen
|
||||
- text()
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
#include "Verkehrsmittel.h"
|
||||
class Luftfahrzeug : public Verkehrsmittel{
|
||||
private:
|
||||
int maxFlughöhe;
|
||||
public:
|
||||
Luftfahrzeug (int maxFlughöhe){
|
||||
this->maxFlughöhe = maxFlughöhe;
|
||||
};
|
||||
std::string text();
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include "Radfahrzeug.h"
|
||||
#include "Verkehrsmittel.h"
|
||||
|
||||
class PKW : public Radfahrzeug {
|
||||
private:
|
||||
int anzahlTüren;
|
||||
|
||||
public:
|
||||
PKW(int raeder, int türen) : Radfahrzeug(raeder) { anzahlTüren = türen; }
|
||||
std::string text();
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include "Verkehrsmittel.h"
|
||||
|
||||
class Radfahrzeug : public Verkehrsmittel {
|
||||
private:
|
||||
int anzahlRäder;
|
||||
|
||||
public:
|
||||
Radfahrzeug(int räder) { this->anzahlRäder = räder; }
|
||||
std::string text();
|
||||
int getRäder();
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
class Verkehrsmittel{
|
||||
private:
|
||||
int posX = 0;
|
||||
int posY = 0;
|
||||
int position[2] = {posX,posY};
|
||||
public:
|
||||
void bewege(int x, int y);
|
||||
virtual std::string text();
|
||||
int getX();
|
||||
int getY();
|
||||
};
|
||||
@@ -1,9 +1,10 @@
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include "Verkehrsmittel.h"
|
||||
#include "Luftfahrzeug.h"
|
||||
#include "Radfahrzeug.h"
|
||||
#include "PKW.h"
|
||||
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
//Verkehrsmittel
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
#include "Luftfahrzeug.h"
|
||||
#include "PKW.h"
|
||||
#include "Radfahrzeug.h"
|
||||
#include "Verkehrsmittel.h"
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
// Verkehrsmittel - Position x: 0; Position y: 0
|
||||
int Verkehrsmittel::getX() { return posX; }
|
||||
int Verkehrsmittel::getY() { return posY; }
|
||||
int Radfahrzeug::getRäder() { return anzahlRäder; }
|
||||
|
||||
void Verkehrsmittel::bewege(int x, int y) {
|
||||
this->posX = x;
|
||||
this->posY = y;
|
||||
}
|
||||
|
||||
std::string Verkehrsmittel::text() {
|
||||
std::string Xstring = std::to_string(getX());
|
||||
std::string Ystring = std::to_string(getY());
|
||||
std::string Fahrzeug = "Verkehrsmittel";
|
||||
std::stringstream output;
|
||||
output << Fahrzeug << " - " << "Position x: " << Xstring
|
||||
<< "; Position y: " << Ystring;
|
||||
return output.str();
|
||||
}
|
||||
|
||||
std::string Luftfahrzeug::text() {
|
||||
std::string Xstring = std::to_string(getX());
|
||||
std::string Ystring = std::to_string(getY());
|
||||
std::string FlughöheString = std::to_string(maxFlughöhe);
|
||||
std::string Fahrzeug = "Luftfahrzeug";
|
||||
std::stringstream output;
|
||||
output << Fahrzeug << " - " << "Position x: " << Xstring
|
||||
<< "; Position y: " << Ystring << "; max. Höhe: " << FlughöheString;
|
||||
return output.str();
|
||||
}
|
||||
|
||||
std::string Radfahrzeug::text() {
|
||||
std::string Xstring = std::to_string(getX());
|
||||
std::string Ystring = std::to_string(getY());
|
||||
std::string RäderString = std::to_string(anzahlRäder);
|
||||
std::string Fahrzeug = "Radfahrzeug";
|
||||
std::stringstream output;
|
||||
output << Fahrzeug << " - " << "Position x: " << Xstring
|
||||
<< "; Position y: " << Ystring << "; Anzahl Räder: " << RäderString;
|
||||
return output.str();
|
||||
}
|
||||
|
||||
std::string PKW::text() {
|
||||
std::string Xstring = std::to_string(getX());
|
||||
std::string Ystring = std::to_string(getY());
|
||||
std::string Räderstring = std::to_string(getRäder());
|
||||
std::string TürenString = std::to_string(anzahlTüren);
|
||||
std::string Fahrzeug = "PKW";
|
||||
std::stringstream output;
|
||||
output << Fahrzeug << " - " << "Position x: " << Xstring
|
||||
<< "; Position y: " << Ystring << "; Anzahl Räder: " << Räderstring
|
||||
<< "; Anzahl Türen: " << TürenString;
|
||||
return output.str();
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
Executable
BIN
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
#include "Klavier.h"
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
Klavier::Klavier() { cout << "Konstruktor: Klavier()" << endl; }
|
||||
Klavier::~Klavier() { cout << "Destruktor: ~Klavier()" << endl; }
|
||||
void Klavier::spielen() { cout << "Klavier klimpert" << endl; }
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include "Musikinstrument.h"
|
||||
class Klavier : Musikinstrument {
|
||||
public:
|
||||
Klavier();
|
||||
virtual ~Klavier();
|
||||
virtual void spielen();
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
#include "Musiker.h"
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include "Musiker.h"
|
||||
#include "Musikinstrument.h"
|
||||
#include <string>
|
||||
|
||||
class Musiker {
|
||||
private:
|
||||
std::string name;
|
||||
const Musikinstrument instrument;
|
||||
|
||||
public:
|
||||
Musiker();
|
||||
Musiker(std::string iname);
|
||||
virtual ~Musiker();
|
||||
void weiseInstrumentZU(const Musikinstrument *instrument);
|
||||
void spielen();
|
||||
std::string liefereName();
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
#include "Musikinstrument.h"
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
Musikinstrument::Musikinstrument() {
|
||||
cout << "Konstruktor: Musikinstrument()" << endl;
|
||||
}
|
||||
Musikinstrument::Musikinstrument(string name) {
|
||||
this->name = name;
|
||||
cout << "Konstruktor: Musikinstrument(string name): " << name << endl;
|
||||
}
|
||||
Musikinstrument::~Musikinstrument() {
|
||||
cout << "Destruktor: Irgentein Musikinstrument" << endl;
|
||||
}
|
||||
void Musikinstrument::spielen() {
|
||||
cout << "Irgentein Musikinstrument erklingt irgentwie" << endl;
|
||||
}
|
||||
string Musikinstrument::liefereName() { return name; }
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
class Musikinstrument {
|
||||
private:
|
||||
std::string name;
|
||||
|
||||
public:
|
||||
Musikinstrument();
|
||||
Musikinstrument(std::string name);
|
||||
~Musikinstrument();
|
||||
virtual void spielen();
|
||||
std::string liefereName();
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
#include "Orchester.h"
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "Musiker.h"
|
||||
#include <vector>
|
||||
|
||||
class Orchester {
|
||||
private:
|
||||
std::vector<Musiker> musiker;
|
||||
|
||||
public:
|
||||
Orchester();
|
||||
virtual ~Orchester();
|
||||
void spielen();
|
||||
void hinzufügen(Musiker const *musiker);
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "Trompete.h"
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
Trompete::Trompete() { cout << "Konstruktor: Trompete()" << endl; }
|
||||
Trompete::~Trompete() { cout << "Destruktor: ~Trompete()" << endl; }
|
||||
void Trompete::spielen() { cout << "Trompete trötet" << endl; }
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include "Musikinstrument.h"
|
||||
|
||||
class Trompete : Musikinstrument {
|
||||
public:
|
||||
Trompete();
|
||||
virtual ~Trompete();
|
||||
virtual void spielen() override;
|
||||
};
|
||||
Reference in new issue
Block a user