What is the output of the following program ?
class MyClass: def __init__(self, x="Welcome"): self.x = x def display(self): print(self.x) obj_ref = MyClass() obj_ref.display()
None
Welcome
AttributeError
TypeError
The attribute "x" is set inside def __init__ while creating constructor here obj_ref = MyClass() So when display() is called, it will print "Welcome"
def __init__
obj_ref = MyClass()
Comment here: