-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path13.Klassen_2.cpp
More file actions
66 lines (58 loc) · 1.37 KB
/
Copy path13.Klassen_2.cpp
File metadata and controls
66 lines (58 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <iostream>
#include <string>
class Auto {
private:
// feste Eigenschaften
const int reifen = 4;
const int lenkrad = 1;
const int lichter = 12;
const int pedale = 3;
const int sitze = 5;
// variable Eigenschaften
int hubraum_ccm;
int kw;
std::string marke;
std::string modell;
std::string farbe;
std::string typ;
public:
// Default-Konstruktor (gültiger Standardzustand) // Initialisierungsliste
Auto()
: hubraum_ccm(0),
kw(0),
marke("default"),
modell("default"),
farbe("unlackiert"),
typ("Standard")
{
}
// Konstruktor für echte Autos
Auto(int hubraum, int leistung,
std::string m, std::string mo,
std::string f, std::string t)
: hubraum_ccm(hubraum),
kw(leistung),
marke(m),
modell(mo),
farbe(f),
typ(t)
{
}
void zeigeAuto() const {
std::cout
<< "Folgendes Fahrzeug wurde gebaut:\n"
<< "Marke:\t" << marke << "\n"
<< "Modell:\t" << modell << "\n"
<< "Farbe:\t" << farbe << "\n"
<< "Hubraum (ccm):\t" << hubraum_ccm << "\n"
<< "Leistung (kW):\t" << kw << "\n"
<< "Bauart:\t" << typ << "\n";
}
};
int main() {
Auto a1; // Default-Auto
a1.zeigeAuto();
std::cout << "\n";
Auto a2(1800, 64, "Opel", "Vectra", "blau", "Kombi");
a2.zeigeAuto();
}