Ask Question
7 November, 20:32

What will be the output of the following Python code? class A: def test1 (self) : print (" test of A called ") class B (A) : def test (self) : print (" test of B called ") class C (A) : def test (self) : print (" test of C called ") class D (B, C) : def test2 (self) : print (" test of D called ") obj=D () obj. test ()

+2
Answers (1)
  1. 7 November, 21:30
    0
    "test of B called"

    Explanation:

    The object is created for the D class, but there are two test methods in class B and C. The D class does not hold any test method. So when the object called the test method. Then the B method is called. It is because the B class is declared first in the inheritance of D class like in the statement "class D (B, C) ". If the statement will be "class D (C, B) ", then the C method will be called. if the D class holds the method test, then only the D method will be called. Hence the output is "test of B called".
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “What will be the output of the following Python code? class A: def test1 (self) : print (" test of A called ") class B (A) : def test ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers