Matthias Reichstam
/
Projektorientiert_1_TINF
Projektorientiert_1_TINF Class
Diff: main.cpp
- Revision:
- 0:dc78186f5037
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Nov 15 17:15:54 2018 +0000 @@ -0,0 +1,50 @@ +#include <stdio.h> + +class Beva { +public: // Methode + + // Inlinemethode + void eingabe(); + + void rechner(); + + // Nur Funktionsprototyping: Methodendefinition ausserhalb der Klasse + void ausgabe(); + + private: // Memebervariable + + int Zahl1; + int Zahl2; + int Zahl3; + +}; // Strichpunkt nicht vergessen + +// Klasse instanziieren +Beva mein; + + +int main() { + // Methodenaufruf + mein.eingabe(); // Funktionsaufruf + mein.rechner(); // Funktionsaufruf + mein.ausgabe(); // Funktionsaufruf + + return 0; +} + +// Methodendefinition + +void Beva::ausgabe() +{ + printf("Hallo Bulme: %d \n ",Zahl3); +} + +void Beva::eingabe() +{ + scanf("%i",&Zahl1); + scanf("%i",&Zahl2); +} + +void Beva::rechner(){ + Zahl3 = Zahl1 + Zahl2; + } \ No newline at end of file