“Is a” vs “Has a” relationship
Methods and variables defined in a subclasses are only available inside the subclass and it's subclasses A subclass becomes the superclass for its subclasses Important: A subclass has NO ACCESS…
Methods and variables defined in a subclasses are only available inside the subclass and it's subclasses A subclass becomes the superclass for its subclasses Important: A subclass has NO ACCESS…
Output: 4 Star 4 Important: The subclass CANNOT access PRIVATE variables and methods of the superclass
Food is the superclass and Cat and Dog are the subclasses, as they inherit all the methods and variables of the food superclass. Example 1) Outputs: I am the eat…