-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
48 lines (37 loc) · 919 Bytes
/
test.cpp
File metadata and controls
48 lines (37 loc) · 919 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include<iostream>
using namespace std;
class Base {
public:
// Base(int a) {
// cout << "in base class constructor " << a << endl;
// }
void basefunction() {
cout << "base function" << endl;
}
virtual void virtualfunction() {
cout << "virtual function in base" << endl;
}
virtual void purevirtualfunction() = 0;
};
class Derived : public Base{
public:
// Derived() {
// cout << "int derived class constructor " << endl;
// }
void derivedfunction() {
cout << "derived function" << endl;
}
void virtualfunction() {
cout << "virtual function in derived" << endl;
}
void purevirtualfunction() {
cout << "pure virtual function in derived" << endl;
}
};
int main() {
Derived d;
d.basefunction();
d.derivedfunction();
d.virtualfunction();
d.purevirtualfunction();
}