1. Class Device:
The Device class has a method printSize that, when called, prints the string "medium".
2. Class Tablet:
The Tablet class inherits from Device but does not define any additional methods or attributes. Therefore, it inherits all methods from Device, including printSize.
3. Creating an Instance of Tablet:
tablet = Tablet() creates an instance of the Tablet class.
4. Calling printSize Method:
tablet.printSize() calls the printSize method on the Tablet instance. Since Tablet inherits Device and does not override printSize, it uses the printSize method from Device, which prints "medium".
Output: The correct answer is "medium".
0 Comments:
Post a Comment