Robin Handy
/
Initialisierungsliste2
uebung2
Diff: main.cpp
- Revision:
- 1:e07846393551
- Parent:
- 0:61df0633020a
- Child:
- 2:e4ce9aad8291
--- a/main.cpp Tue Oct 06 16:19:40 2020 +0000 +++ b/main.cpp Tue Oct 13 16:33:29 2020 +0000 @@ -5,13 +5,16 @@ class MyClassA{ public: MyClassA(int x, bool wahr) : _x(x), _wahr(wahr) {} + MyClassA() : _x(), _wahr(){ //Ueberladener Konstruktor + _x = 10; + } void printstatus(){ printf("x ist: %d\n", _x); printf("bool ist: %d\n", _wahr); } - int getx(void) {return _x;} + private: int _x; bool _wahr; @@ -19,6 +22,7 @@ }; MyClassA myclassA(5,1); +MyClassA m2; int main() @@ -26,7 +30,8 @@ myclassA.printstatus(); - wait_ms(500); + wait_ms(1000); + m2.printstatus(); } -} +} \ No newline at end of file