fork(5) download
  1. #include <stdio.h>
  2.  
  3. class Beva {
  4. public:
  5. // Inlinemethode; Methodendefinition in der Klasse
  6. void eingabe() {
  7. scanf("%s", str);
  8. }
  9. // Nur Funktionsprototyping; Methodendefinition ausserhalb der Klasse
  10. void ausgabe();
  11. private:
  12. char str[80];
  13. };
  14.  
  15. // Klasse instanziieren
  16. Beva mein;
  17.  
  18. int main() {
  19. // Methodenaufruf
  20. mein.eingabe();
  21. mein.ausgabe();
  22. return 0;
  23. }
  24.  
  25. // Methodendefinition
  26. void Beva :: ausgabe() {
  27. printf("Hello Bulme: %s \n", str);
  28. }
Success #stdin #stdout 0s 4352KB
stdin
Standard input is empty
stdout
Hello Bulme: