forked from grantrostig/cpp_by_example
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.cpp
More file actions
24 lines (23 loc) · 470 Bytes
/
main.cpp
File metadata and controls
24 lines (23 loc) · 470 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
#include <string>
using namespace std;
// base derived function super this self
class Super_class {
public:
virtual void print() const {
cout<<"Super:print."<<endl;
}
};
class Sub_class : Super_class {
public:
void print() const override final {
Super_class::print();
cout<<"Sub :print."<<endl;
}
};
int main() {
Sub_class sub_class {};
sub_class.print();
cout << "###" << endl;
return 0;
}