Created
May 14, 2018 11:55
-
-
Save pperehozhih/c3a974ab57095fb19a449702444f3251 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Foo { | |
int getA() const { return a; } | |
private: | |
int a = 10; | |
friend class Bar; | |
}; | |
class Bar { | |
Bar(Foo* instance):instance(instance){} | |
Foo* operator ->() { | |
return instance; | |
} | |
void setA(int a) { | |
instance->a = a; | |
} | |
private: | |
Foo* instance = nullptr; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment