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.
main.cpp@0:9aebea3abcf7, 2018-11-15 (annotated)
- Committer:
- Wizo
- Date:
- Thu Nov 15 18:08:56 2018 +0000
- Revision:
- 0:9aebea3abcf7
TINF_Objektorientiert
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Wizo | 0:9aebea3abcf7 | 1 | #include <stdio.h> |
| Wizo | 0:9aebea3abcf7 | 2 | |
| Wizo | 0:9aebea3abcf7 | 3 | class Beva |
| Wizo | 0:9aebea3abcf7 | 4 | { |
| Wizo | 0:9aebea3abcf7 | 5 | public: |
| Wizo | 0:9aebea3abcf7 | 6 | //Inlinemethode; Methodendefinition in der Klasse |
| Wizo | 0:9aebea3abcf7 | 7 | void eingabe() |
| Wizo | 0:9aebea3abcf7 | 8 | { |
| Wizo | 0:9aebea3abcf7 | 9 | scanf("%i", &zahl1); |
| Wizo | 0:9aebea3abcf7 | 10 | scanf("%i", &zahl2); |
| Wizo | 0:9aebea3abcf7 | 11 | } |
| Wizo | 0:9aebea3abcf7 | 12 | |
| Wizo | 0:9aebea3abcf7 | 13 | //Nur Funktionsprototyping; Methodendefinition ausserhalb der Klasse |
| Wizo | 0:9aebea3abcf7 | 14 | void ausgabe(); |
| Wizo | 0:9aebea3abcf7 | 15 | |
| Wizo | 0:9aebea3abcf7 | 16 | |
| Wizo | 0:9aebea3abcf7 | 17 | private: |
| Wizo | 0:9aebea3abcf7 | 18 | |
| Wizo | 0:9aebea3abcf7 | 19 | int zahl1; |
| Wizo | 0:9aebea3abcf7 | 20 | int zahl2; |
| Wizo | 0:9aebea3abcf7 | 21 | |
| Wizo | 0:9aebea3abcf7 | 22 | }; |
| Wizo | 0:9aebea3abcf7 | 23 | |
| Wizo | 0:9aebea3abcf7 | 24 | //Funktionsprototyping |
| Wizo | 0:9aebea3abcf7 | 25 | |
| Wizo | 0:9aebea3abcf7 | 26 | |
| Wizo | 0:9aebea3abcf7 | 27 | |
| Wizo | 0:9aebea3abcf7 | 28 | //Klasse instanziieren |
| Wizo | 0:9aebea3abcf7 | 29 | Beva mein; |
| Wizo | 0:9aebea3abcf7 | 30 | |
| Wizo | 0:9aebea3abcf7 | 31 | int main() { |
| Wizo | 0:9aebea3abcf7 | 32 | |
| Wizo | 0:9aebea3abcf7 | 33 | //Methodenaufruf |
| Wizo | 0:9aebea3abcf7 | 34 | mein.eingabe(); |
| Wizo | 0:9aebea3abcf7 | 35 | mein.ausgabe(); |
| Wizo | 0:9aebea3abcf7 | 36 | //eingabe (str); |
| Wizo | 0:9aebea3abcf7 | 37 | //ausgabe(str); |
| Wizo | 0:9aebea3abcf7 | 38 | |
| Wizo | 0:9aebea3abcf7 | 39 | return 0; |
| Wizo | 0:9aebea3abcf7 | 40 | } |
| Wizo | 0:9aebea3abcf7 | 41 | |
| Wizo | 0:9aebea3abcf7 | 42 | //Methodendefintion |
| Wizo | 0:9aebea3abcf7 | 43 | |
| Wizo | 0:9aebea3abcf7 | 44 | void Beva::ausgabe() |
| Wizo | 0:9aebea3abcf7 | 45 | { |
| Wizo | 0:9aebea3abcf7 | 46 | printf("Hello Bulme: %i \n", zahl1 + zahl2); |
| Wizo | 0:9aebea3abcf7 | 47 | } |