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.
You are viewing an older revision! See the latest version
Klasse Date only Day
Date nur Tag¶
aus mbed-Simulator
und Intro
Copy-Paste die folgenden Codes
#include "mbed.h" class Date // nur day implementiert; TODO: month and year { private: uint8_t day; public: Date():day(1) // Initialisierungsliste mit konstantem Parameterwert {} // Initialisierungsliste über parametrisierten Konstruktor Date(uint8_t _day):day(_day) { // entspircht: day = _day; .... siehe unten } Date(uint8_t _day, int _tmp) { day = _day; } ~Date() { printf("Good bye\n"); } // Destruktor uint8_t GetDay(); // Prototyping }; uint8_t Date::GetDay() { return day; } int main() { Date date1; // Instanziierung mit Standard Konstruktor und Date date2(18); // mit parametrisierten Konstruktor Date date3(30, 0); // mit parametrisierten Konstruktor printf("GetDay Test\n"); printf("Day 1: %d\n", date1.GetDay()); printf("Day 2: %d\n", date2.GetDay()); printf("Day 3: %d\n", date3.GetDay()); return 0; }