Dr. Pucher
/
7ABELI_MyClass_Initlist
Test
Revision 0:a2fdf0dba4fa, committed 2020-10-06
- Comitter:
- bulmecisco
- Date:
- Tue Oct 06 16:57:15 2020 +0000
- Commit message:
- Test
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r a2fdf0dba4fa main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Oct 06 16:57:15 2020 +0000 @@ -0,0 +1,42 @@ +#include "mbed.h" + +class MyClass +{ +public: + MyClass(double messwert) : _messwert(messwert) { } + MyClass() : _messwert(0.0) { } + + void status() + { + printf("%f\n", _messwert); + } +private: + double _messwert; +}; + +class MyClassB +{ +private: + I2C i2c; + float result; + +public: + MyClassB(PinName sda, PinName scl) : i2c(sda, scl){ + result = 0; + } + float read(); +}; + +float MyClassB::read() { + return result; +} + +MyClass myClass(0.0); +MyClassB sensor(p28, p27); + +int main() { + myClass.status(); + wait_ms(100); + + printf("Sensorwert: %f \n", sensor.read()); +}
diff -r 000000000000 -r a2fdf0dba4fa mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Oct 06 16:57:15 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file