Robin Handy
/
Initialisierungslisten
1 Uebung
main.cpp@4:6bea8ed92ad7, 2020-10-06 (annotated)
- Committer:
- rob117
- Date:
- Tue Oct 06 16:17:45 2020 +0000
- Revision:
- 4:6bea8ed92ad7
- Parent:
- 3:dbd662e5f8f8
- Child:
- 5:a0a51cfb3981
uebung1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rob117 | 0:928e720c71da | 1 | #include "mbed.h" |
rob117 | 2:3c3a6f0b11d2 | 2 | |
rob117 | 4:6bea8ed92ad7 | 3 | class MyClass |
rob117 | 4:6bea8ed92ad7 | 4 | { |
rob117 | 4:6bea8ed92ad7 | 5 | public: |
rob117 | 4:6bea8ed92ad7 | 6 | MyClass(double messwert) : _messwert(messwert) //Initialisierungsliste |
rob117 | 4:6bea8ed92ad7 | 7 | { |
rob117 | 4:6bea8ed92ad7 | 8 | } |
rob117 | 4:6bea8ed92ad7 | 9 | |
rob117 | 4:6bea8ed92ad7 | 10 | void status() //Funktion die den status von Messwert abfragt |
rob117 | 4:6bea8ed92ad7 | 11 | { |
rob117 | 4:6bea8ed92ad7 | 12 | printf("%f\n", _messwert); |
rob117 | 4:6bea8ed92ad7 | 13 | |
rob117 | 4:6bea8ed92ad7 | 14 | } |
rob117 | 4:6bea8ed92ad7 | 15 | |
rob117 | 4:6bea8ed92ad7 | 16 | private: |
rob117 | 4:6bea8ed92ad7 | 17 | double _messwert; |
rob117 | 4:6bea8ed92ad7 | 18 | }; |
rob117 | 3:dbd662e5f8f8 | 19 | |
rob117 | 2:3c3a6f0b11d2 | 20 | |
rob117 | 4:6bea8ed92ad7 | 21 | MyClass myclass(0); |
rob117 | 2:3c3a6f0b11d2 | 22 | |
rob117 | 2:3c3a6f0b11d2 | 23 | int main() |
rob117 | 4:6bea8ed92ad7 | 24 | { |
rob117 | 4:6bea8ed92ad7 | 25 | while(1) { |
rob117 | 4:6bea8ed92ad7 | 26 | |
rob117 | 4:6bea8ed92ad7 | 27 | myclass.status(); |
rob117 | 4:6bea8ed92ad7 | 28 | wait_ms(500); |
rob117 | 4:6bea8ed92ad7 | 29 | } |
rob117 | 2:3c3a6f0b11d2 | 30 | } |
rob117 | 2:3c3a6f0b11d2 | 31 |