Advertisement
Josif_tepe

Untitled

Oct 16th, 2021
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. class student {
  5. private:
  6.     string name, surname;
  7.     int age;
  8. public:
  9.     student(string _name, string _surname, int _age);
  10.     void print();
  11.     ~student();
  12. };
  13. student::student(string _name, string _surname, int _age) {
  14.     name = _name;
  15.     surname = _surname;
  16.     age = _age;
  17. }
  18. void student::print() {
  19.     cout << name << " " << surname << " " << age << endl;
  20. }
  21. student::~student() {
  22.    
  23. }
  24. int main() {
  25.     student s("a", "b", 100);
  26.     s.print();
  27.     return 0;
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement