A superclass Record has been defined to store the names and ranks of 50 students. Define a sub-class Rank to find the highest rank along with the name.
The details of both classes are given below:
Class name: Record
Data members/instance variables:
name[]: to store the names of students
mk[]: to store the ranks of students
Member functions:
Record(): constructor to initialize data members
void readvalues(): to store the names and ranks
void display(): displays the names and the corresponding ranks
Class name: Rank
Data members/instance variables:
index: integer to store the index of the topmost rank Member functions:
Rank(): constructor to invoke the base class constructor and to initialize index = 0
void highest(): finds the index/location of the topmost rank and stores it in the index
without sorting the array.
void display(): displays the names and rank along with the name haring the topmost rank.
Under what Principle does the above entity work?