Advertisement
Josif_tepe

Untitled

Sep 4th, 2021
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. class student {
  6. private:
  7.     string name;
  8.     string surname;
  9.     int age;
  10. public:
  11.     student() {
  12.        
  13.     }
  14.     student(string _name, string _surname, int _age) {
  15.         name = _name;
  16.         surname = _surname;
  17.         age = _age;
  18.     }
  19.    
  20.     string get_name() {
  21.         return name;
  22.     }
  23.     string get_surname() {
  24.         return surname;
  25.     }
  26.     int get_age() {
  27.         return age;
  28.     }
  29.     void set_name(string _name) {
  30.         name = _name;
  31.     }
  32.     void set_surname(string _surname) {
  33.         surname = _surname;
  34.     }
  35.     void set_age(int _age) {
  36.         age = _age;
  37.     }
  38. };
  39. int main() {
  40.     student s("pavle", "pavlevski", 20);
  41.     s.set_surname("trpeski");
  42.     s.set_age(100);
  43.     cout << s.get_name() << " " << s.get_surname() << " " << s.get_age() << endl;
  44.     return 0;
  45. }
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement