M Mỹ Duyên New member Sep 20, 2021 #1 What will be the output of the following Python code? Code: class A: def one(self): return self.two() def two(self): return 'A' class B(A): def two(self): return 'B' obj2=B() print(obj2.two()) A. A B. An exception is thrown C. A B D. B
What will be the output of the following Python code? Code: class A: def one(self): return self.two() def two(self): return 'A' class B(A): def two(self): return 'B' obj2=B() print(obj2.two()) A. A B. An exception is thrown C. A B D. B
P Phan Thị Thùy Dương Member Sep 20, 2021 #2 Answer: d Explanation: The derived class method two() overrides the method two() in the base class A. Upvote 0 Downvote
Answer: d Explanation: The derived class method two() overrides the method two() in the base class A.