Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <String>
- using namespace std;
- class CAddress {
- private:
- string m_street;
- string m_pcode;
- string m_city;
- public:
- CAddress(){
- m_street = "Plaza";
- m_pcode = "9010";
- m_city = "Varna";
- }
- CAddress(const string& strStreet,const string& strPcode, const string& strCity = "Varna") :
- m_street(strStreet), m_pcode(strPcode), m_city(strCity) {};
- CAddress(const CAddress& addr) : m_street(addr.m_street), m_pcode(addr.m_pcode), m_city(addr.m_city) {};
- void output (ostream &toStream){
- toStream<< m_street << " "<< m_pcode << " " << m_city << endl;
- }
- };
- class CPerson {
- private:
- string name;
- string EGN;
- public:
- CPerson() : name("petrakis"), EGN("123412341234"){};
- CPerson(const string& nameInput, const string& egnInput) : name(nameInput), EGN(egnInput){};
- };
- class CStudent : CPerson {
- private:
- CAddress m_address;
- string m_FN;
- public:
- CStudent() {
- m_FN = "xxxx";
- }
- CStudent (const string& strName, const string& strEGN, const CAddress& addr, const string& fakNum) : m_address(addr), CPerson(strName, strEGN){};
- CStudent(const CStudent& st) : m_address(st.m_address), m_FN("xxxx"){};
- };
- void main(){
- cout << "sazdavane na adresi we";
- CAddress a1("Stud 5", "9010"), a2("Bartcheda", "9020", "Ot selo"), a3, a4(a1);
- a1.output(cout);
- a2.output(cout);
- a3.output(cout);
- a4.output(cout);
- CStudent s1("bratcheda2", "15151515", a2, " "), s2("bratcheda3", "151515",a3, "1862.."), s3(), s4(s1);
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement