Week 2 - Deeper OOP Fundamentals (Encapsulation and Inheritance) - Lab Without Answer (20250131120633)
Week 2 - Deeper OOP Fundamentals (Encapsulation and Inheritance) - Lab Without Answer (20250131120633)
Section:
Date:
Objectives
Instructions
4. Test Cases:
o Create a Student object and a Teacher object.
o Set and get their private and protected attributes using appropriate methods.
o Call display_info() for both objects to display all details.
Additional Task
• Add a method update_age() in the Person class to increase or decrease the person's
age. Test this method in both subclasses.
Activity Title: "Managing Animals in a Zoo Using Inheritance and Access Modifiers"
Objective:
Instructions:
1. What is the purpose of using access modifiers (public, protected, and private) in a class?
2. Why do we use super() in the subclasses?
3. What are the advantages of overriding methods in a subclass?