Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Beispiel Klasse Date
https://os.mbed.com/users/fpucher/code/HIM0Board/wiki/Klasse-Date-only-Day
#include "mbed.h" class Date // nur day implementiert; TODO: month and year { private: uint8_t day; uint8_t month; uint8_t year; public: Date():day(1), month(1), year(1) // Initialisierungsliste mit konstantem Parameterwert {} // Initialisierungsliste über parametrisierten Konstruktor Date(uint8_t _day, uint8_t _month, uint8_t _year): day(_day), month(_month), year(_year) { // entspircht: day = _day; .... siehe unten } Date(uint8_t _day, uint8_t _month, uint8_t _year, int _tmp) { day = _day; month = _month; year = _year; } ~Date() { printf("Good bye\n"); } // Destruktor uint8_t GetDay(); // Prototyping uint8_t GetMonth(); uint8_t GetYear(); }; uint8_t Date::GetDay() { return day; } uint8_t Date::GetMonth() { return month; } uint8_t Date::GetYear() { return year; } int main() { Date date1; // Instanziierung mit Standard Konstruktor und Date date2(18, 15, 10); // mit parametrisierten Konstruktor Date date3(1, 1, 1, 0); // mit parametrisierten Konstruktor printf("GetDay Test\n"); printf("Day 1: %d\n", date1.GetDay()); printf("Day 2: %d, Month 2: %d, Year 2: %d\n", date2.GetDay(), date2.GetMonth(), date2.GetYear()); printf("Day 3: %d, Month 3: %d, Year 3: %d\n", date3.GetDay(), date3.GetMonth(), date3.GetYear()); return 0; }