Created
December 16, 2014 20:11
-
-
Save simonlynen/9ebbf0c616549f6dfe39 to your computer and use it in GitHub Desktop.
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 C { | |
public: | |
class Key { | |
friend std::shared_ptr<C> make_c(); | |
Key() {} | |
}; | |
C(const Key &); | |
//... | |
}; | |
std::shared_ptr<C> make_c() { | |
return std::make_shared<C>(C::Key()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Only allow access to methods for a single other method / class without exposing the entire private section by friending.