Überladene parametrisierte Konstruktor

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Reichi19
Date:
Thu Nov 15 17:16:50 2018 +0000
Commit message:
?berladene parametrisierte Konstruktor

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 1de190b15b50 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 15 17:16:50 2018 +0000
@@ -0,0 +1,41 @@
+#include "mbed.h"
+#include <stdio.h>
+
+class Beva {
+    
+private:   // Memebervariable
+    char str[80]; 
+public:   // Methode
+    Beva(){  // Standart-Konstruktor
+        strcpy(str,"InitString"); // Initialisieren der Memo Variable
+    }
+    // Überladene parametrisierte Konstruktor
+    Beva(char _str[]){
+        strcpy(str, _str);
+    }
+    void eingabe(void);
+    void ausgabe(void);
+
+}; // Strichpunkt nicht vergessen
+
+// Klasse instanziieren
+
+void Beva::ausgabe(void){
+    printf("String:%s", str);
+}
+void Beva::eingabe(void){
+    scanf("%s", str);
+}
+
+DigitalOut led(LED1);
+Beva eva("ROT");
+
+int main() {
+    while (1) {
+        led = !led;
+        printf("Blink! LED is now %d\n", led.read());
+        eva.eingabe();
+        eva.ausgabe();
+        wait_ms(500);
+    }
+}
diff -r 000000000000 -r 1de190b15b50 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Nov 15 17:16:50 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/5aab5a7997ee
\ No newline at end of file