Przykład tworzenia klas, też funkcji wirtualnej w klasie-bazie.
Shape.h@0:f66cecb955ba, 2016-03-22 (annotated)
- Committer:
- kch78
- Date:
- Tue Mar 22 09:29:40 2016 +0000
- Revision:
- 0:f66cecb955ba
1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kch78 | 0:f66cecb955ba | 1 | #ifndef MBED_SHAPE_H |
kch78 | 0:f66cecb955ba | 2 | #define MBED_SHAPE_H |
kch78 | 0:f66cecb955ba | 3 | #include "mbed.h" |
kch78 | 0:f66cecb955ba | 4 | #include <string> |
kch78 | 0:f66cecb955ba | 5 | |
kch78 | 0:f66cecb955ba | 6 | class Shape |
kch78 | 0:f66cecb955ba | 7 | { |
kch78 | 0:f66cecb955ba | 8 | public: |
kch78 | 0:f66cecb955ba | 9 | float width; |
kch78 | 0:f66cecb955ba | 10 | float height; |
kch78 | 0:f66cecb955ba | 11 | virtual float getArea() {}; |
kch78 | 0:f66cecb955ba | 12 | }; |
kch78 | 0:f66cecb955ba | 13 | |
kch78 | 0:f66cecb955ba | 14 | #endif |