Advertisement
Guest User

petrakisa e hermafrodit

a guest
Oct 2nd, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <String>
  3.  
  4. using namespace std;
  5.  
  6. class CAddress {
  7. private:
  8.     string m_street;
  9.     string m_pcode;
  10.     string m_city;
  11.  
  12. public:
  13.     CAddress(){
  14.         m_street = "Plaza";
  15.         m_pcode = "9010";
  16.         m_city = "Varna";
  17.     }
  18.  
  19.     CAddress(const string& strStreet,const string& strPcode, const string& strCity = "Varna") :
  20.         m_street(strStreet), m_pcode(strPcode), m_city(strCity) {};
  21.  
  22.     CAddress(const CAddress& addr) : m_street(addr.m_street), m_pcode(addr.m_pcode), m_city(addr.m_city) {};
  23.  
  24.     void output (ostream &toStream){
  25.          toStream<< m_street << " "<< m_pcode << " " << m_city << endl;
  26.     }
  27. };
  28.  
  29.  class CPerson {
  30. private:
  31.     string name;
  32.     string EGN;
  33.    
  34.  public:
  35.      CPerson() : name("petrakis"), EGN("123412341234"){};
  36.      CPerson(const string& nameInput, const string& egnInput) : name(nameInput), EGN(egnInput){};
  37. };
  38.  
  39. class CStudent : CPerson {
  40. private:
  41.     CAddress m_address;
  42.     string m_FN;
  43.    
  44.  
  45. public:
  46.     CStudent() {
  47.         m_FN = "xxxx";
  48.     }
  49.  
  50.     CStudent (const string& strName, const string& strEGN, const CAddress& addr, const string& fakNum) : m_address(addr), CPerson(strName, strEGN){};
  51.     CStudent(const CStudent& st) : m_address(st.m_address), m_FN("xxxx"){};
  52. };
  53.  
  54. void main(){
  55.     cout << "sazdavane na adresi we";
  56.     CAddress a1("Stud 5", "9010"), a2("Bartcheda", "9020", "Ot selo"), a3, a4(a1);
  57.  
  58. a1.output(cout);
  59.     a2.output(cout);
  60.     a3.output(cout);
  61.     a4.output(cout);
  62.  
  63.     CStudent s1("bratcheda2", "15151515", a2, " "), s2("bratcheda3", "151515",a3, "1862.."), s3(), s4(s1);
  64.  
  65.     system("pause");
  66.  
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement