Section 1/4Class Relationships
Class Relationships
Explore this concept
Project: School Management System
Build a school management system that demonstrates all four pillars of OOP: encapsulation (protected attributes, validated setters), inheritance (Student and Teacher extend Person), polymorphism (__str__ on each class), and abstraction (well-defined interfaces for each class).
Class Relationships
Person
/ \
Student Teacher
\ /
Classroom
◇─── Teacher (composition: room assigns teacher)
◇─── Student (aggregation: students exist independently)