Robin Handy
/
Initialisierungslisten
1 Uebung
Revision 5:a0a51cfb3981, committed 2020-10-13
- Comitter:
- rob117
- Date:
- Tue Oct 13 16:14:18 2020 +0000
- Parent:
- 4:6bea8ed92ad7
- Commit message:
- ueberladener Konstruktor
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 6bea8ed92ad7 -r a0a51cfb3981 main.cpp --- a/main.cpp Tue Oct 06 16:17:45 2020 +0000 +++ b/main.cpp Tue Oct 13 16:14:18 2020 +0000 @@ -3,29 +3,37 @@ class MyClass { public: - MyClass(double messwert) : _messwert(messwert) //Initialisierungsliste + MyClass() : _messwert(0) //Initialisierungsliste { + _messwert = 1; } - + MyClass(double messwert) : _messwert(messwert){ //Ueberladener Konstruktor + + } + void status() //Funktion die den status von Messwert abfragt { - printf("%f\n", _messwert); + printf("messwert: %f\n", _messwert); } + + + private: double _messwert; }; -MyClass myclass(0); +MyClass m1; +MyClass m(6); int main() { while(1) { - myclass.status(); + m1.status(); wait_ms(500); + m.status(); } -} - +} \ No newline at end of file