Question: class Test : def __init__ ( self ): self .t1= T1 self .t2= T2 #main program x=Test() When x=Test() executes nothing happens in the memory
class Test: def __init__(self): self.t1="T1" self.t2="T2" #main program x=Test()
When x=Test() executes nothing happens in the memory unless we type print(x.t1) and print(x.t2). Then the object for the class is instantiated and the output is T1, T2.
When x=Test() executes nothing happens in the memory unless we type print(x.t1). Then the object is instantiated and the output is T1.
When x=Test() executes the class Test is calls the class Test to execute
When x=Test() executes the __init__() method is called and executes.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
