This repository contains two Python assignments demonstrating object-oriented programming concepts such as inheritance, polymorphism, and encapsulation, themed around "the boys."
- Defines a
Boyclass with attributes and methods. - Defines a
SingingBoysubclass that inherits fromBoyand overrides a method to demonstrate polymorphism. - Demonstrates constructors to initialize objects with unique values.
- Defines a base
Boyclass with private attributes (encapsulation). - Defines
SingingBoyandDancingBoysubclasses that inherit fromBoy. - Each subclass overrides the
action()method to demonstrate polymorphism. - Includes getter methods to access private attributes.
Run them using Python 3:
python assignment1.py
python assignment2.pyEach script will print output demonstrating the respective OOP concepts.
Created as a demonstration of OOP principles with a "boys" theme.