mail@pastecode.io avatar
19 days ago
1.3 kB
1. Create a base class BankAccount with attributes like account number, account holder
name, and balance. Derive one class, SavingsAccount from the base class. Override method for interest calculation in the savings account.
2. Create a multilevel inheritance hierarchy for employees in an organization. Implement a base class "Employee" with common attributes like employee ID, name, and salary. Derive two classes, "Manager" and "Worker," from the "Employee" class. Further, derive a class "Executive" from the "Manager" class. Each subclass should have additional attributes and methods specific to their roles.
3. Design a base class "Person" with attributes like name, age, and address. Derive a class "Student" from the "Person" class with attributes such as roll number and marks. Extend this hierarchy with a class "StudentLeader" derived from the "Student" class, incorporating details about leadership roles and responsibilities.
4. Implement a base class Person with attributes such as name and address. Derive two classes Employee and Manager from Person, and then further create a class Executive that inherits from both Employee and Manager. Implement appropriate methods for each class, and demonstrate how hybrid inheritance can be used to model different levels of employees
Leave a Comment