Getting ready
To understand the concept of multilevel inheritance practically, let's create an application that will prompt the user to enter the code, name, history marks, and geography marks of a student, and will display the total marks and percentage on the click of a button. The total marks will be the sum of history marks and geography marks. Assuming the maximum mark for each is 100, the formula for computing the percentage is: total marks/200 * 100.
The code and name entered by the user will be assigned to the class members of a class called Student. The history and geography marks will be assigned to the class members of another class called Marks.
To access code and name, along with the history and geography marks, the Result class ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access