some more content
This commit is contained in:
24
OOP/inheritance/multilevel.cpp
Normal file
24
OOP/inheritance/multilevel.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class Parent {
|
||||
public:
|
||||
void function() {
|
||||
cout << "Parent Class!";
|
||||
}
|
||||
};
|
||||
|
||||
class MyChild: public Parent {
|
||||
// Child Function here
|
||||
};
|
||||
|
||||
class MyGrandChild: public MyChild {
|
||||
// Grandchild Function here
|
||||
};
|
||||
|
||||
int main() {
|
||||
MyGrandChild classobj;
|
||||
classobj.function();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user