![]() |
Class Composition ile İlgili #include #include class car { private: char color[15]; char model[20]; int year; plate p1; owner o1; public: car(char* c,char* m,int y,char* cod,int n,char* nam,char* s,char* cit,int ap) 1(cod,n),o1(nam,s,cit,ap){ strcpy(color,c); strcpy(model,m); year=y; } void print() { cout<<"CAR"< cout<<"---------------------------------------------------"< cout<<"Color :"< Model :"< Year :"< cout<<" "; p1.print(); o1.print(); } }; class address{ private: char street[20]; char city[20]; int aptno; public: address(char* s,char* c,int a) { strcpy(street,s); strcpy(city,c); aptno=a; } void print() { cout<<"ADDRESS"< cout<<"-----------------------------------------"< cout<<"Street :"< City :"< Ap no :"< } }; class owner{ private: char name[20]; address ad1; public: owner(char* n,char* st,char* ct,int ap):ad1(st,ct,ap) { strcpy(name,n); } void print() { cout<<"OWNER"< cout<<"---------------------------------------------------"< cout<<"Name :"< cout<<" "; ad1.print(); } }; class plate{ private: char ccode[5]; int number; public: plate(char* c,int n) { strcpy(ccode,c); number=n; } void print() { cout<<"PLATE"< cout<<"-----------------------------------------------"< cout<<"Plate Code :"< Plate No :"< cout<<" "; } }; void main() { car c1("Navi","SaaB",2007,"EmR",34,"eMRe","TC","TR",1 9 05); c1.print(); } belgesi-746 DOĞU AKDENİZ ÜNV. |
| Tüm Zamanlar GMT +3 Olarak Ayarlanmış. Şuanki Zaman: 22:11. |
Powered by vBulletin® Version 3.8.9 Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Site kurucuları: Damla ve Meltem