forked from Dashark/hello-world
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Operator.cpp
45 lines (45 loc) · 812 Bytes
/
Operator.cpp
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
#include <iostream>
class Parent {
public:
Parent(int n) {
flag = n;
std::cout << "Parent()" << flag << std::endl;
}
virtual ~Parent(){
std::cout << "~~~Parent()" << flag << std::endl;
}
//other methods????
void show();
private:
//attributes??
int flag;
};
class Child : public Parent {
public:
Child(int n):Parent(n) {
flag = n;
std::cout << "Child()" << n << std::endl;
}
virtual ~Child(){
std::cout << "~~~Child()" << flag << std::endl;
}
//other methods????
//function object
void operator() (int n) {
}
private:
//attributes??
int flag;
void operator= (const Child &c) {
std::cout << "operator = " << flag << std::endl;
}
};
int main() {
Parent *p;
p = new Child(1);
Child c(2);
//c = Child(3);
//p->?????();
delete p;
return 0;
}