fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. class Tutor {
  6. public:
  7. Tutor();
  8. void Print() const;
  9.  
  10. private:
  11. string name;
  12. string topic;
  13. };
  14.  
  15. Tutor::Tutor() : name("Unnamed"), topic("NoTopic") {}
  16.  
  17. void Tutor::Print() const {
  18. cout << name << ": " << topic << endl;
  19. }
  20.  
  21. int main() {
  22. Tutor myTutor;
  23.  
  24. myTutor.Print();
  25.  
  26. return 0;
  27. }
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
Unnamed: NoTopic