fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3. class Cat
  4. {
  5. public:
  6. string name;
  7. int age;
  8. Cat(string c, int a)
  9. {name=c;
  10. age=a;
  11. }
  12.  
  13. void getData()
  14. {cout<<"Yours cat name is "<<name<<endl;
  15. cout<<"And he/she is "<<age<<" years old."<<endl;}
  16. };
  17. int main()
  18. {string s; int d;
  19. cin>>s>>d;
  20. Cat first(s, d);
  21. first.getData ();
  22.  
  23. return 0;
  24. }
  25.  
  26.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
Yours cat name is 
And he/she is 5219 years old.