Advertisement
martukha

hyman.h

Feb 18th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #pragma once
  2. #include<string>
  3. #include<iostream>
  4.  
  5. using namespace std;
  6.  
  7. class Human {
  8. protected:
  9.     string name;
  10.     string surname;
  11.     int data;
  12. public:
  13.     Human(): name(), surname(), data(0){}
  14.     Human(string na, string su,int d): name(na),surname(su),data(d){}
  15.     Human(const Human& h): name(h.name), surname(h.surname), data(h.data){}
  16.     virtual ~Human() {}
  17.  
  18.  
  19.     friend ostream& operator<<(ostream& out, const Human& h){
  20.         out<<"Name:"<<h.name<<"\t"<<"Surname:"<<h.surname<<"\t"<<"Data:"<<h.data<<endl;
  21.         return out;
  22.     }
  23.     friend istream& operator>>(istream& in, Human& h) {
  24.         in >> h.name;
  25.         in >> h.surname;
  26.         in >> h.data;
  27.         return in;
  28.     }
  29.  
  30.  
  31. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement