-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprac3.cpp
87 lines (82 loc) · 1.37 KB
/
prac3.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
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
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
/*class A {
private:
int a;
static int cnt;
static A obj;
A(int i = 0) : a(i) {}
A(const A& el) {
a = el.a;
}
~A() {}
public:
static A& cr(int i = 0) {
if(!cnt) {
cnt++;
obj.a = i;
}
else if(cnt == 1) {
obj.a = i;
cnt++;
}
return obj;
}
static A* cp(const A& el) {
return &obj;
}
void print() const {
cout << a << endl;
}
};
*/
/*
class A {
private:
int a;
~A() {}
public:
A(int i = 0) : a(i) {}
A(const A& el) {
a = el.a;
}
static void del(const A& el) {
el.~A();
}
};
int main() {
char* buf = new char[10000000];
A* ptr[100];
for(int i=0;i<100;i++) {
ptr[i] = new (&buf + i*sizeof(A)) A;
}
for(int i=0;i<100;i++) {
A::del(*(ptr[i]));
}
delete[] buf;
}
*/
class A {
private:
const A& i;
const A& j;
public:
A(): i(*this), j(*this) {};
const A& operator, (const A& p) const {
return *this;
}
const A& operator[] (const A& a) const {
return *this;
}
int operator() (const A& a, const A& b) const {
return 0;
}
int f1() {
return (i, j)[i, j](i, j);
}
};
int main() {
return 0;
}