Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
22
Task/Inverted-syntax/C++/inverted-syntax.cpp
Normal file
22
Task/Inverted-syntax/C++/inverted-syntax.cpp
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
class invertedAssign {
|
||||
int data;
|
||||
public:
|
||||
invertedAssign(int data):data(data){}
|
||||
int getData(){return data;}
|
||||
void operator=(invertedAssign& other) const {
|
||||
other.data = this->data;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#include <iostream>
|
||||
|
||||
int main(){
|
||||
invertedAssign a = 0;
|
||||
invertedAssign b = 42;
|
||||
std::cout << a.getData() << ' ' << b.getData() << '\n';
|
||||
|
||||
b = a;
|
||||
|
||||
std::cout << a.getData() << ' ' << b.getData() << '\n';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue