#include <stdio.h> #include
#include class induk{ int x; public: void set_x(int ox){ x=ox;} int get_x(){ return(x); }}; class turunan: public induk{ int y; public: void set_y(int oy){ y=oy;} int get_y(){ return(y);}}; int main(){ induk a;
a.set_x(15); cout<<"Nilai X yang dipanggil dari kelasInduk = "; cout< #include #include class induk{ int x; public: void set_x(int ox){ x=ox;} int get_x(){ return(x); }}; class turunan01: public induk{ int y; public: void set_y(int oy){ y=oy;} int get_y(){ return(y);}};
class turunan02:public turunan01{ int z; public: void set_z(int oz){ z=oz;} int get_z(){ return(z);}}; int main(){ turunan02 a; a.set_x(10); a.set_y(20); a.set_z(30); cout<<"Nilai X yang dipanggil dari kelas Turunan 02 = "; cout<
#include <stdio.h rel="nofollow"> #include #include class induk01{ int x; public: void set_x(int ox){ x=ox;} int get_x(){ return(x); }}; class induk02{ int y; public: void set_y(int oy){ y=oy;} int get_y(){ return(y);}};
class turunan:public induk01,public induk02{ int z; public: void set_z(int oz){ z=oz;} int get_z(){ return(z);}}; int main(){ turunan a; a.set_x(11); a.set_y(12); a.set_z(13); cout<<"Nilai X = "; cout< #include #include class induk{ int x; public: induk(int ox){ cout<<"Constructor Kelas Induk"<<endl; x=ox;} //function get_x int get_x(){ return(x); }}; class turunan: public induk{ int y; public: turunan(int ox,int oy):induk(ox) { cout<<"Constructor Kelas Turunan"<<endl; y=oy;} //function get_y int get_y(){ return(y);}};
int main(){ turunan a(33,55); cout<<"Nilai X = "; cout< #include #include class induk01{ int x; public: induk01(int ox){ cout<<"Constructor Kelas Induk 01"<<endl; x=ox;} //function get_x int get_x(){ return(x); }}; class induk02{ int y; public: induk02(int oy) { cout<<"Constructor Kelas Induk 02"<<endl; y=oy;} //function get_y int get_y(){ return(y);}};
class turunan:public induk01,public induk02 { int z; public: turunan(int ox,int oy,int oz):induk01(ox),induk02(oy) { cout<<"Constructor Kelas Turunan"<<endl; z=oz;} //function get_y int get_z(){ return(z);}}; int main(){ turunan a(1,2,3); cout<<"Nilai X = "; cout<