+ 2

Is friendly class or function a bed design?

Usually if we use dynamic_cast, it is mean that our design is poor. If we use a friend class it's a poor design because it's a lack of functionality in our class? Or maybe the same as in operator overloading it have to be a friend class if we want declare them out of the class. What do you thing?

22nd Dec 2016, 12:43 PM
Grzegorz Duraj
Grzegorz Duraj - avatar
1 Odpowiedź
+ 1
I think that friend classes help to encapsulate functionality linked to a class which are not directly linked to an instance of the class (such as operator<<). But I am not sure either :/
27th Dec 2016, 9:59 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar