We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This is very poor understanding of inheritance, The classes WestBengal, Karnataka and AndhraPradesh being shown as subclasses of State. They are instances of State class and not subclasses as given in the problem.
Such poor examples create wrong concepts for students.
A better example for sub class could have been
Region as super class and Country, State, City as subclasses.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Covariant Return Types
You are viewing a single comment's thread. Return to all comments →
This is very poor understanding of inheritance, The classes WestBengal, Karnataka and AndhraPradesh being shown as subclasses of State. They are instances of State class and not subclasses as given in the problem. Such poor examples create wrong concepts for students. A better example for sub class could have been Region as super class and Country, State, City as subclasses.