Bonjour
Dans Exceptionnal C++, Sutter affirme ceci:
Voici une hiérarchie, certainement pas exhaustive des relations entre les héritages, du plus fort au plus faible.If a class relationship can be expressed in more than one way, use the weakest relationship that's pratical. Given that inheritence is nearly the strongest relationship you can express in C++, it's only really appropriate when there is no equivalent weaker alternative.
J'aimerais bien avoir l'avis des experts, surtout pour la compléter.
frendship
public inheritence
private inheritence
layering (composition)
Pourquoi choisir toujours la relation la plus faible?
Merci
Partager