Skip to content

Commit 72ef51b

Browse files
committed
Override Identifier
1 parent 9002546 commit 72ef51b

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include<iostream>
2+
3+
class Parent {
4+
5+
public:
6+
virtual void getData() {
7+
8+
std::cout << "Parent getData " << std::endl;
9+
}
10+
};
11+
12+
class Child : public Parent {
13+
14+
public:
15+
virtual void getData() override {
16+
17+
std::cout << "Child getData " << std::endl;
18+
}
19+
};
20+
21+
int main() {
22+
23+
Parent *obj = new Child();
24+
obj->getData();
25+
return 0;
26+
}

0 commit comments

Comments
 (0)