Les génériques interagissent avec l'héritage de manière non évidente. La règle la plus importante : si Dog étend Animal, List<Dog> n'est PAS un sous-type de List<Animal>. C'est ce qu'on appelle l'invariance et existe pour préserver la sécurité des types.
Les types génériques sont invariants
Full content is available with a subscription.
Get full access to all courses on the platform for one year with a single payment.
▼
Unlike other platforms that charge per course, here you get everything for one price, and after one year of use there will be no automatic charge for the following year.