---46---
Question:
>Define a class named American and its subclass NewYorker.
Hints:
>Use class Subclass(ParentClass) to define a subclass.
Solution :
---47---
Question:
>Define a class named Circle which can be constructed by a radius. The Circle class has a method which can compute the area.
Hints:
>Use def methodName(self) to define a method.
Solution:
---48---
Question:
>Define a class named Rectangle which can be constructed by a length and width. The Rectangle class has a method which can compute the area.
Hints:
>Use def methodName(self) to define a method.
Solution:
---49---
Question:
>Define a class named Shape and its subclass Square. The Square class has an init function which takes a length as argument. Both classes have a area function which can print the area of the shape where Shape's area is 0 by default.
Hints:
>To override a method in super class, we can define a method with the same name in the super class.
Solution:
---50---
Question:
>Please raise a RuntimeError exception.