Skip to content

Commit c5cba44

Browse files
authored
Create Multi_level_Inheritance.cpp
1 parent aa081f6 commit c5cba44

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Multi_level_Inheritance.cpp

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#include <iostream>
2+
using namespace std;
3+
class Animal {
4+
public:
5+
void eat() {
6+
cout<<"Eating..."<<endl;
7+
}
8+
};
9+
class Dog: public Animal
10+
{
11+
public:
12+
void bark(){
13+
cout<<"Barking..."<<endl;
14+
}
15+
};
16+
class BabyDog: public Dog
17+
{
18+
public:
19+
void weep() {
20+
cout<<"Weeping...";
21+
}
22+
};
23+
int main(void) {
24+
BabyDog d1;
25+
d1.eat();
26+
d1.bark();
27+
d1.weep();
28+
return 0;
29+
}

0 commit comments

Comments
 (0)