Inheritance and Composition: Is-a and Has-a

Two ways to build a class from another: inheritance, where an e-bike is a bike and overrides its price, and composition, where a bike has a lock it keeps as a field; saying the relationship aloud, is-a or has-a, tells you which one fits.

By

Updated

Cheat sheet: Inheritance and Composition: Is-a and Has-a
Category
Data Structures
Level
Apprentice
Tags
Composition, c-sharp, inheritance, Is-a vs Has-a, java, JavaScript, Method Overriding, OOP, python, typescript