Skip to content

Instantly share code, notes, and snippets.

@kkabdol
Last active February 16, 2016 08:04
Show Gist options
  • Save kkabdol/0de09db1cdd842186c65 to your computer and use it in GitHub Desktop.
Save kkabdol/0de09db1cdd842186c65 to your computer and use it in GitHub Desktop.
friend class example
class B {
friend class A;
private:
int i;
};
class A {
public:
A(B b) {
// legal access due to friendship
b.i = 0;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment