Inheritance and Class Hierarchies
Doctors, nurses and drivers share so much — so why write the same code three times?
What this unit covers
Unit 2: The Four Pillars of Object-Oriented Programming
- 1 Encapsulation and Access ModifiersA locked box with a counter window: private data, and public methods that check everything going in. · 5 min
- 2 Inheritance and Class HierarchiesDoctors, nurses and drivers share so much — so why write the same code three times? · 7 min
- 3 Polymorphism: Method Overloading and OverridingWhen NEPA takes light, one call to switch on the backup gets three different answers — that's polymorphism. · 5 min
- 4 Abstraction: Abstract Classes and InterfacesA good menu tells you what you can order and hides how the kitchen cooks it — learn to design classes the same way. · 9 min