C++ Patterns: The Badge
awesomekling.github.io
C++ Patterns: The Badge
1–10 of 160 posts
Re: C++ Patterns: The Badge
#2--
C++'s private inheritance can be used here to avoid some of the gymnastics, wherein, that private aspect of the class can be passed out into the appropriate party at creation time or otherwise.
To illustrate: https://gist.github.com/arithma/0d96aec5c07e2d8dc24cfc6cd31f...
Note: I have never used this in production as far as I remember.
Re: C++ Patterns: The Badge
#3Re: C++ Patterns: The Badge
#4How can {} return a Badge object? Some kind of operator overload?
Re: C++ Patterns: The Badge
#5How can {} return a Badge object? Some kind of operator overload?
Re: C++ Patterns: The Badge
#6Re: C++ Patterns: The Badge
#7Re: C++ Patterns: The Badge
#8Re: C++ Patterns: The Badge
#9I like it but is access restriction really a problem? In my years of C++ programming it always seemed to be a theoretical problem more than something that leads to crashes.
Re: C++ Patterns: The Badge
#10I usually avoid 'friend' in these situations and just write
//private:
before the method declaration. But it actually happened that co-workers
used these private methods because they use code-completion instead of
reading the header...But I might would call the class Friend or something.