Show the printout of the following program:
class A:
def __new__(self):
print("A's __new__() invoked")
def __init__(self):
print("A's __init__() invoked")
class B(A):
def __new__(self):
print("B's __new__() invoked")
def __init__(self):
print("B's __init__() invoked")
def main():
b = B()
a = A()
main() # Call the main function
The given program:
class A:
def __new__(self):
print("A's __new__() invoked")
def __init__(self):
print("A's __init__() invoked")
class B(A):
def __new__(self):
print("B's __new__() invoked")
def __init__(self):
print("B's __init__() invoked")
def main():
b = B()
a = A()
main() # Call the main function
output:
Python 3.2.1 (default, Jul 10 2011, 21:51:15) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
B's __new__() invoked
A's __new__() invoked
>>>