Intermediate
Module 7: Advanced Object-Oriented Concepts
Go beyond the basics of classes by mastering deep inheritance hierarchies, advanced polymorphism, and interface-driven design.
Designing Robust Inheritance Hierarchies
Learn to evaluate when inheritance is the right tool, organize shared behavior, and protect hierarchies from brittle coupling.
Method Overriding Rules & Contracts
Revisit overriding with an emphasis on covariant return types, visibility constraints, and exception compatibility.
Deep Dive: The super Keyword
Use `super` for constructor chaining and to extend, not replace, inherited behavior.
Abstract Classes vs Interfaces
Choose the right construct to model shared behavior, default implementations, and optional capabilities.
Multiple Inheritance Through Interfaces
Resolve conflicting defaults, compose behaviors, and document intent when a class implements several interfaces.
Default & Static Interface Methods
Add behavior to existing interfaces without breaking clients by leveraging default and static utilities.
Marker Interfaces & Metadata Alternatives
Understand historical marker interfaces and modern annotation-based replacements.
Advanced Polymorphism Patterns
Apply polymorphism to strategy, state, and visitor patterns for flexible runtime behavior.
Casting, instanceof, and Pattern Matching
Use safe casting techniques, pattern matching, and `sealed` classes to enforce invariants.
Composition vs Inheritance
Decide when delegation beats inheritance and how to migrate brittle hierarchies toward composition.
Mini-Project: Shape Hierarchy
Build an extensible shape system that calculates area/perimeter and renders SVG output.