QuestionQ50

VerifiedObject-Oriented Programming

Assuming the following inheritance hierarchy is in effect, which classes are correctly declared?

Question Image

Choose two
Explanation

Python’s method-resolution order must preserve each inheritance relationship. Class_1(C, D) has a consistent ordering because C and D can precede their common ancestor A. Class_4(D, A) is valid because D can precede its ancestor A. Listing B before D conflicts with D’s inheritance from B, and listing A before C conflicts with C’s inheritance from A.

Community Discussion

No comments yet. Be the first to start the discussion!