Create a base class called shape. It contains two methods getxyvalue() and showxyvalue() for accepting co-ordinates and to display the same. Create the subclass called Rectangle which contains a method to display the length and breadth of the rectangle called showxyvalue().Use overriding concept.
Output: Inside Shape -> x = 10 y = 20 Inside Rectangle -> x = 40 y = 50
No comments:
Post a Comment