Matthaeus Vorraber
/
LPC1768_class_exercice_ueberladen
Ueberladen1
Revision 3:bd21a5fcccf0, committed 2020-10-13
- Comitter:
- happy_alien
- Date:
- Tue Oct 13 16:17:56 2020 +0000
- Parent:
- 2:4ceb0547f2cf
- Commit message:
- Ueberladen1
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
main3_copy.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 4ceb0547f2cf -r bd21a5fcccf0 main.cpp --- a/main.cpp Tue Oct 06 16:30:54 2020 +0000 +++ b/main.cpp Tue Oct 13 16:17:56 2020 +0000 @@ -1,25 +1,36 @@ #include "mbed.h" -void printStatus(void); +void printWert(void); class MyClass { public: + MyClass(): _messwert(0){ + _messwert=1; + } MyClass(double messwert):_messwert(messwert) { } - - void printStatus(){ + + void printWert(){ printf("Status is now: %f\n", _messwert); } +void printWert(int izahl){ + printf("Wert ist jetzt: %f izahl: %d\n", _messwert,izahl);} +void printWert(int izahl, int anz) +{ + anz=20; + printf("Status is now: %f izahl %d anz %d\n", _messwert,izahl,anz); +} private: double _messwert; }; MyClass messwert(0.0); +MyClass messwert2(2.0); @@ -28,10 +39,18 @@ int main() { while (1) { + int anzahl=0; - messwert.printStatus(); + messwert.printWert(); + wait_ms(500); + messwert2.printWert(); wait_ms(500); + messwert2.printWert(100); + wait_ms(500); + messwert2.printWert(100,anzahl); + } } +}
diff -r 4ceb0547f2cf -r bd21a5fcccf0 main3_copy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main3_copy.cpp Tue Oct 13 16:17:56 2020 +0000 @@ -0,0 +1,53 @@ +#include "mbed.h" + +void printStatus(void); + +class MyClassA +{ +public: + MyClassA(int x, bool wahr): _x(x),_wahr(wahr) {} + + + + + + void printStatus() + { + printf("Status is now: %d,%d\n", _x,_wahr); + } + int getx(void) + { + return _x; + } +private: + int _x; + bool _wahr; +}; + +MyClassA messwert(15,1); + + + + +int main() +{ + while (1) { + + messwert.printStatus(); + wait_ms(500); + + + } +} + + +int main() +{ + while (1) { + + messwert.printStatus(); + wait_ms(500); + + + } +}