python的类子类,类的继承

【编程题】定义一个名为Shape的类及其子类Square。子类Square的init方法中增加了一个边长参数length。这两个类都有一个计算面积的area方法,Shape的area默认输出面积为0。
提示:可考虑在继承时重写方法,进一步理解多态性。

class Shape():
    def __init__(self):
        pass
    def area(self):
        return 0
    
    
class Square(Shape):
    """"""
    def __init__(self, length):
        self.length = length
        
    def area(self):
        return self.length * self.length
    
    
s = Shape()
r = s.area()
s1 = Square(4)
print(s1.area())