fork download
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. class Student {
  6. char name[50];
  7. char surname[50];
  8. int age;
  9. public:
  10. Student(char name[], char surname[], int age) {
  11. strcpy(this->name, name); // please explain this line what does it means?
  12. strcpy(this->surname, surname);
  13. this->age = age;
  14. }
  15. void Show() {
  16. cout << "Name: " << this->name << endl;
  17. cout << "Surname: " << this->surname << endl;
  18. cout << "Age: " << this->age;
  19. }
  20. };
  21.  
  22. int main() {
  23. Student A("Ivan", "Sidoroff", 25);
  24. A.Show();
  25.  
  26. return 0;
  27. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
Name: Ivan
Surname: Sidoroff
Age: 25