-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode.cpp
100 lines (84 loc) · 1.83 KB
/
code.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
88
89
90
91
92
93
94
95
96
97
98
99
100
#include<iostream>
using namespace std;
class ItsMagic{
public:
int* value;
ItsMagic(int n = 8): value(new int[n - 5] {n})
{
for(int i=0; i<n-7; i++)
*(value + i + 1) = *(value + i) + i + 3;
cout<<"Hello <:> "<<value[2]<<endl;
}
ItsMagic(const ItsMagic& oh)
{
this->value = oh.value + 1;
*this->value = *oh.value + 5;
(*this)(oh.value + 1);
cout<<"Oh Ho <:> "<<value[2]<<endl;
}
int& operator()(int *a)
{
*(this->value + 2) = *a++;
cout<<"Is it you -): "<<*this->value<<endl;
return *(this->value + 1);
}
void increase(int &n)
{
static int N = 5;
n = N++;
if(n % 3 == 2)
this->twice(N);
cout<<"Seriously -> "<<N<<endl;
}
void twice(int &n)
{
static int N = 6;
n = ++N;
if(n % 4 == 0)
this->increase(N);
cout<<"Please -> "<<N<<endl;
}
~ItsMagic()
{
int s = 3;
cout<<"Don't..... ";
this->increase(s);
cout<<s<<endl;
}
};
class NoWay{
public:
ItsMagic okay;
int s;
NoWay(int a):okay(a)
{
s = *okay.value + 3;
cout<<*(okay.value + 2)<<endl;
cout<<"Its Okay :) "<<okay(okay.value)<<endl;
}
ItsMagic& neverMind()
{
okay.increase(s);
cout<<"Never Mind :( "<<s + okay(okay.value + 1)<<endl;
return okay;
}
~NoWay()
{
int sum = 0;
cout<<"Are you going ? \n";
for(int i=0; i<3; i++)
sum += okay.value[i];
cout<<"Here take this -> "<<sum<<endl;
}
};
void comeHere(ItsMagic boo)
{
boo(boo.value);
cout<<"Bye :( "<<*boo.value++<<endl;
}
int main()
{
ItsMagic isIt;
NoWay areYou(10);
comeHere(areYou.neverMind());
}