0% found this document useful (0 votes)
15 views2 pages

Multilevel Inheritance

Uploaded by

Ak. Production
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

Multilevel Inheritance

Uploaded by

Ak. Production
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1: #include<iostream>

2: #include<conio.h>
3: using namespace std;
4: class student
5: {
6: protected:
7: int roll_number;
8: public:
9: void getnumber(int);
10: void putnumber(void);
11: };
12: class test:public student
13: {
14: protected:
15: float sub1;
16: float sub2;
17: public:
18: void getmarks(float, float);
19: void putmarks(void);
20: };
21: class result:public test
22: {
23: private:
24: float total;
25: public:
26: void display(void);
27: };
28: void student::getnumber(int a)
29: {
30: roll_number=a;
31: }
32: void student::putnumber(void)
33: {
34: cout<<"roll number="<<roll_number<<endl;
35: }
36: void test::getmarks(float x, float y)
37: {
38: sub1=x;
39: sub2=y;
40: }
41: void test::putmarks(void)
42: {
43: cout<<"marks in sub1="<<sub1<<"\n";
44: cout<<"marks in sub2="<<sub2<<"\n";
45: }
46: void result::display(void)
47: {
48: total=sub1+sub2;
49: putnumber();
50: putmarks();
51: cout<<"Total="<<total<<"\n";
52: }
53: int main ()
54: {
55: result student1;
56: student1.getnumber(127);
57: student1.getmarks(98, 99.50);
58: student1.display();
59: }

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy