What will be displayed by the following code?

Loading

Practice Method Overriding Questions – What will be displayed by the following code?
class A:
    def __init__(self, i = 0):
        self.i = i
    def m1(self):
        self.i += 1
class B(A):
    def __init__(self, j = 0):
        A.__init__(self, 3)
        self.j = j
    def m1(self):
        self.j += 1
def main():
    b = B()
    b.m1()
    print(b.i, b.j)
main()

What will be displayed by the following code?

Loading

Practice Polymorphism Questions – What will be displayed by the following code?
class A:
    def __init__(self, i = 2, j = 3):
        self.i = i
        self.j = j
    def __str__(self):
        return“A”
    def __eq__(self, other):
        return self.i * self.j == other.i * other.j
def main():
    x = A(1, 2)
    y = A(2, 1)
    print(x == y)
main()