Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Download
Standard view
Full view
of .
Look up keyword
Like this
14Activity
0 of .
Results for:
No results containing your search query
P. 1
Hybrid Inheritance

Hybrid Inheritance

Ratings: (0)|Views: 3,859|Likes:
Published by api-3741719

More info:

Published by: api-3741719 on Oct 17, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

03/18/2014

pdf

text

original

 
17. Multilevel Inheritance
class student{protected:int roll_no;public:void get_roll(int a) { roll_no=a; }void put_roll(void) { cout<<"Roll_no:"<<roll_no<<endl; }};class test : public student{protected:float sub1,sub2,sub3;public:void get_marks(float a,float b,float c) { sub1=a; sub2=b;sub3=c; }void put_marks(void){cout<<"Sub1="<<sub1<<endl;cout<<"Sub2="<<sub2<<endl;cout<<"Sub3="<<sub3<<endl;}};class result : public test{float total; //private member by defaultpublic:void display(void){total=sub1+sub2+sub3;put_roll();put_marks();cout<<"Total="<<total<<endl;}};int main(){result s1;s1.get_roll(501);s1.get_marks(60,75.7,89.34);s1.display();return (0);}
18. Hybrid Inheritance
1
 
class student{protected:int roll_no;public:void get_roll(int a) { roll_no=a; }void put_roll(void) { cout<<"Roll_no:"<<roll_no<<endl; }};class test : public student{protected:float sub1,sub2,sub3;public:void get_marks(float a,float b,float c) { sub1=a; sub2=b;sub3=c; }void put_marks(void){cout<<"Sub1="<<sub1<<endl;cout<<"Sub2="<<sub2<<endl;cout<<"Sub3="<<sub3<<endl;}};class sports{protected:float score;public:void get_score(float s) { score=s; }void put_score(void) { cout<<"Score="<<score<<endl;} };class result : public test,public sports{float total; //private member by defaultpublic:void display(void){total=sub1+sub2+sub3+score;put_roll();put_marks();put_score();cout<<"Total="<<total<<endl;}};int main(){result s1;s1.get_roll(501);s1.get_marks(60,75.7,89.34);2

Activity (14)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
veerabcs liked this
barvinfathima liked this
Mahmood Alam liked this
Raj Shah liked this
sethuraja16 liked this
Siva Ganesh liked this
dassdass22 liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->