fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. class Print {
  6. private:
  7. string text;
  8. public:
  9. void setText(string t);
  10. void drucke();
  11. void drucke(string str);
  12. };
  13.  
  14. void Print::setText(string t)
  15. {
  16. text = t;
  17. }
  18.  
  19. void Print::drucke() {
  20. cout << text;
  21. }
  22.  
  23. void Print::drucke(string str)
  24. {
  25. cout << str;
  26. }
  27.  
  28. Print aus;
  29.  
  30. int main() {
  31. Print *a = new Print();
  32. a->drucke("test");
  33. aus.setText("Hello World\n");
  34. aus.drucke();
  35. aus.drucke("Hello Bulme\n");
  36. return 0;
  37. }
  38.  
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
testHello World
Hello Bulme