Skip to content

Instantly share code, notes, and snippets.

@pperehozhih
Created May 14, 2018 11:55
Show Gist options
  • Save pperehozhih/c3a974ab57095fb19a449702444f3251 to your computer and use it in GitHub Desktop.
Save pperehozhih/c3a974ab57095fb19a449702444f3251 to your computer and use it in GitHub Desktop.
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