Init Liste messwert mit 0 initialisieren
Dependencies: mbed
main.cpp@0:6a84376bbf45, 2020-10-06 (annotated)
- Committer:
- floras
- Date:
- Tue Oct 06 15:30:37 2020 +0000
- Revision:
- 0:6a84376bbf45
MyClass Init Listen
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
floras | 0:6a84376bbf45 | 1 | #include "mbed.h" |
floras | 0:6a84376bbf45 | 2 | |
floras | 0:6a84376bbf45 | 3 | |
floras | 0:6a84376bbf45 | 4 | |
floras | 0:6a84376bbf45 | 5 | class MyClass{ |
floras | 0:6a84376bbf45 | 6 | public: |
floras | 0:6a84376bbf45 | 7 | MyClass(double messwert) : _messwert(messwert) { |
floras | 0:6a84376bbf45 | 8 | } |
floras | 0:6a84376bbf45 | 9 | |
floras | 0:6a84376bbf45 | 10 | void status() { |
floras | 0:6a84376bbf45 | 11 | printf("%f\n", _messwert); |
floras | 0:6a84376bbf45 | 12 | |
floras | 0:6a84376bbf45 | 13 | } |
floras | 0:6a84376bbf45 | 14 | |
floras | 0:6a84376bbf45 | 15 | private: |
floras | 0:6a84376bbf45 | 16 | double _messwert; |
floras | 0:6a84376bbf45 | 17 | }; |
floras | 0:6a84376bbf45 | 18 | |
floras | 0:6a84376bbf45 | 19 | |
floras | 0:6a84376bbf45 | 20 | |
floras | 0:6a84376bbf45 | 21 | MyClass myClass (0); |
floras | 0:6a84376bbf45 | 22 | |
floras | 0:6a84376bbf45 | 23 | int main() { |
floras | 0:6a84376bbf45 | 24 | |
floras | 0:6a84376bbf45 | 25 | myClass.status(); |
floras | 0:6a84376bbf45 | 26 | wait_ms(100); |
floras | 0:6a84376bbf45 | 27 | |
floras | 0:6a84376bbf45 | 28 | } |
floras | 0:6a84376bbf45 | 29 |