0% found this document useful (0 votes)
2 views2 pages

Hierarchical Inheritance in OOP Examples

The document outlines two programming practices involving hierarchical inheritance. Practice 01 focuses on creating a university management system with a base class 'Person' and two derived classes 'Student' and 'Faculty', each with specific attributes and methods. Practice 02 describes the development of smart devices with base classes for 'Communication', 'Camera', and 'FitnessTracker', along with derived classes 'SmartPhone' and 'SmartWatch', each featuring unique attributes and methods.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Hierarchical Inheritance in OOP Examples

The document outlines two programming practices involving hierarchical inheritance. Practice 01 focuses on creating a university management system with a base class 'Person' and two derived classes 'Student' and 'Faculty', each with specific attributes and methods. Practice 02 describes the development of smart devices with base classes for 'Communication', 'Camera', and 'FitnessTracker', along with derived classes 'SmartPhone' and 'SmartWatch', each featuring unique attributes and methods.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Practice 01

Implement hierarchical inheritance to manage different types of


people associated with a university.
Specifications
• Base Class: Person
• Attributes: name and id_number.
• Method: display_info(): Returns a string with the person's name and ID.
• Child Class 1: Student (Inherits from Person)
• Additional Attribute: major.
• Method Overriding: Redefine display_info() to include the student's major.
• Child Class 2: Faculty (Inherits from Person)
• Additional Attribute: department.
• Method Overriding: Redefine display_info() to include the faculty's department.
• New Method: assign_course(course_name): Returns a confirm
Practice 02
Make a smart-device.
Base Classes
Class Type Attributes Key Methods
Communication Base brand, model Phone(number): Confirms a call.
Camera Base resolution_mp take_photo(): Confirms a photo capture.
FitnessTracker Base sensor_count monitor_hr(): Confirms heart rate monitoring.

Derived Classes
Class Inherits From Unique Attribute New Method
Communication and stream_video(): Confirms video
SmartPhone storage_gb
Camera streaming.
Communication and sync_data(): Confirms data
SmartWatch battery_life_days
FitnessTracker synchronization.

You might also like