Last active
February 16, 2016 08:04
-
-
Save kkabdol/0de09db1cdd842186c65 to your computer and use it in GitHub Desktop.
friend class example
This file contains 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
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