forked from nihilus/hexrays_tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvirtual_calls_4.cpp
More file actions
executable file
·120 lines (93 loc) · 1.56 KB
/
Copy pathvirtual_calls_4.cpp
File metadata and controls
executable file
·120 lines (93 loc) · 1.56 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#include <stdio.h>
#include <memory.h>
class one
{
int x;
public:
one():x(5)
{
}
virtual ~one()
{
printf("destruct one\n");
}
virtual int boo(){return 1;}
};
class two: public one
{
public:
virtual int boo(){return 2;}
virtual int foo(){return 22;}
virtual ~two()
{
printf("destruct two\n");
}
};
class three: public two
{
public:
one a;
two b;
int c[20];
int d;
int e;
public:
three():d(0),e(0){memset(c,32,20*4);}
virtual ~three()
{
printf("destruct three\n");
}
virtual int boo(){return 3;}
virtual int foo(){return 33;}
virtual int goo(){return 333;}
};
class four: public three
{
public:
int a;
int b;
int c[20];
int d;
four():a(0),b(0),d(0)
{
memset(c,33,20*4);
}
virtual ~four()
{
printf("destruct four\n");
}
virtual int boo(){return 4;}
virtual int foo(){return 44;}
virtual int goo(){return 444;}
};
class five: public four
{
};
struct base {
int value;
virtual void foo() { printf("%d\n", value); }
virtual void bar() { printf("%d\n", value); }
};
struct offset {
char space[10];
};
struct derived : offset, base {
int dvalue;
virtual void foo() { printf("%d\n", value); }
};
void main()
{
five * cls3 = new five();
printf("%d\n",cls3->boo());
printf("%d\n",cls3->foo());
printf("%d\n",cls3->goo());
delete cls3;
derived * d = new derived();
d->dvalue = 5;
d->value = 5;
d->space[0] = 0;
d->space[5] = 5;
d->space[9] = 9;
d->foo();
d->bar();
}