Robin Handy
/
Initialisierungsliste2
uebung2
main.cpp@0:61df0633020a, 2020-10-06 (annotated)
- Committer:
- rob117
- Date:
- Tue Oct 06 16:19:40 2020 +0000
- Revision:
- 0:61df0633020a
- Child:
- 1:e07846393551
uebung2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rob117 | 0:61df0633020a | 1 | #include "mbed.h" |
rob117 | 0:61df0633020a | 2 | |
rob117 | 0:61df0633020a | 3 | |
rob117 | 0:61df0633020a | 4 | |
rob117 | 0:61df0633020a | 5 | class MyClassA{ |
rob117 | 0:61df0633020a | 6 | public: |
rob117 | 0:61df0633020a | 7 | MyClassA(int x, bool wahr) : _x(x), _wahr(wahr) {} |
rob117 | 0:61df0633020a | 8 | |
rob117 | 0:61df0633020a | 9 | void printstatus(){ |
rob117 | 0:61df0633020a | 10 | printf("x ist: %d\n", _x); |
rob117 | 0:61df0633020a | 11 | printf("bool ist: %d\n", _wahr); |
rob117 | 0:61df0633020a | 12 | |
rob117 | 0:61df0633020a | 13 | } |
rob117 | 0:61df0633020a | 14 | int getx(void) {return _x;} |
rob117 | 0:61df0633020a | 15 | private: |
rob117 | 0:61df0633020a | 16 | int _x; |
rob117 | 0:61df0633020a | 17 | bool _wahr; |
rob117 | 0:61df0633020a | 18 | |
rob117 | 0:61df0633020a | 19 | }; |
rob117 | 0:61df0633020a | 20 | |
rob117 | 0:61df0633020a | 21 | MyClassA myclassA(5,1); |
rob117 | 0:61df0633020a | 22 | |
rob117 | 0:61df0633020a | 23 | |
rob117 | 0:61df0633020a | 24 | int main() |
rob117 | 0:61df0633020a | 25 | {while(1){ |
rob117 | 0:61df0633020a | 26 | |
rob117 | 0:61df0633020a | 27 | myclassA.printstatus(); |
rob117 | 0:61df0633020a | 28 | |
rob117 | 0:61df0633020a | 29 | wait_ms(500); |
rob117 | 0:61df0633020a | 30 | |
rob117 | 0:61df0633020a | 31 | } |
rob117 | 0:61df0633020a | 32 | } |