Python Multilevel Inheritance:
Multilevel inheritance in programming (general in object-oriented program). When a base class is derived by a derived class which is derived by another class, then it is called multilevel inheritance.
The below diagram will make things clearer,
All Classes & methods used in the program:
- Class: Student
- Method: getStudentInfo() : gets student's roll number and name from user.
- Method: printStudentInfo() : prints student's roll number and name.
- Class: Bsc
- Method: getBsc() : gets student's marks from user.
- Method: putPerks() : prints student's marks.
- Method: calcTotalMarks() : returns the sum of marks.
- Class : Result
- Method: getResult() : gets student's information and calculate total marks.
- Method: printResult() : prints prints student information.
Program to illustrate multilevel inheritance in Python
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer