Robin Handy
/
Initialisierungslisten
1 Uebung
main.cpp@3:dbd662e5f8f8, 2020-10-06 (annotated)
- Committer:
- rob117
- Date:
- Tue Oct 06 16:13:34 2020 +0000
- Revision:
- 3:dbd662e5f8f8
- Parent:
- 2:3c3a6f0b11d2
- Child:
- 4:6bea8ed92ad7
2uebung
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 | 3:dbd662e5f8f8 | 3 | |
rob117 | 2:3c3a6f0b11d2 | 4 | |
rob117 | 3:dbd662e5f8f8 | 5 | class MyClassA{ |
rob117 | 3:dbd662e5f8f8 | 6 | public: |
rob117 | 3:dbd662e5f8f8 | 7 | MyClassA(int x, bool wahr) : _x(x), _wahr(wahr) {} |
rob117 | 3:dbd662e5f8f8 | 8 | |
rob117 | 3:dbd662e5f8f8 | 9 | void printstatus(){ |
rob117 | 3:dbd662e5f8f8 | 10 | printf("x ist: %d\n", _x); |
rob117 | 3:dbd662e5f8f8 | 11 | printf("bool ist: %d\n", _wahr); |
rob117 | 3:dbd662e5f8f8 | 12 | |
rob117 | 3:dbd662e5f8f8 | 13 | } |
rob117 | 3:dbd662e5f8f8 | 14 | int getx(void) {return _x;} |
rob117 | 3:dbd662e5f8f8 | 15 | private: |
rob117 | 3:dbd662e5f8f8 | 16 | int _x; |
rob117 | 3:dbd662e5f8f8 | 17 | bool _wahr; |
rob117 | 3:dbd662e5f8f8 | 18 | |
rob117 | 0:928e720c71da | 19 | }; |
rob117 | 2:3c3a6f0b11d2 | 20 | |
rob117 | 3:dbd662e5f8f8 | 21 | MyClassA myclassA(5,1); |
rob117 | 2:3c3a6f0b11d2 | 22 | |
rob117 | 2:3c3a6f0b11d2 | 23 | |
rob117 | 2:3c3a6f0b11d2 | 24 | int main() |
rob117 | 3:dbd662e5f8f8 | 25 | {while(1){ |
rob117 | 3:dbd662e5f8f8 | 26 | |
rob117 | 3:dbd662e5f8f8 | 27 | myclassA.printstatus(); |
rob117 | 3:dbd662e5f8f8 | 28 | |
rob117 | 3:dbd662e5f8f8 | 29 | wait_ms(500); |
rob117 | 3:dbd662e5f8f8 | 30 | |
rob117 | 3:dbd662e5f8f8 | 31 | } |
rob117 | 2:3c3a6f0b11d2 | 32 | } |
rob117 | 2:3c3a6f0b11d2 | 33 |