Essay on The Republic Day | Republic Day Essay in English
[ Festival Ganesh Chaturthi Essay in English for Students and Children ] [ Essay on my favourite freedom fighter ] ⚔️ [ दुर्गा पूजा पर निबंध (Durga Puja Hindi Essay) ]
[Essay On 75th Independence Day Of India] [Azadi Ka Amrit Mahotsav Essay in English]

What will be displayed by the following code?

Loading

Practice Polymorphism Questions – What will be displayed by the following code?
class A:
    def __str__(self):
        return“A”
class B(A):
    def __init__(self):
        super().__init__()
class C(B):
    def __init__(self):
        super().__init__()
def main():
    b = B()
    a = A()
    c = C()
    print(a, b, c)
main()

What will be displayed by the following code?

Loading

Practice Polymorphism Questions – What will be displayed by the following code?
class A:
    def __str__(self):
        return“A”
class B(A):
    def __init__(self):
        super().__init__()
class C(B):
    def __init__(self):
        super().__init__()
def main():
    b = B()
    a = A()
    c = C()
    print(a, b, c)
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()