-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path39.cpp
51 lines (46 loc) · 782 Bytes
/
39.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//Multiple Inheritance.
#include<iostream>
using namespace std;
class parent
{
private:
void fun1()
{
cout<<"This is fun1 function";
}
public:
void fun2()
{
cout<<"\nThis is fun2 function";
}
};
class child1 : public parent // syntax of inheritance
{
public:
void fun3()
{
cout<<"\nThis is fun3 function";
}
};
class child2 : public child1
{
public:
void fun4()
{
cout<<"\nThis is fun4 function";
}
};
int main()
{
// child1 c;
child2 c;
/* c.fun1();// error
c.fun2(); //ok
c.fun3(); //ok
c.fun4(); // error*/
//c.fun1(); // error
c.fun2(); // ok
c.fun3(); // ok
c.fun4(); //ok
return 0;
}