QuestionQ116

Object-Oriented Programming

What is the expected behavior of the following code?

Question Image

  • A it outputs 0
  • B it outputs 1
  • C it raises an exception
  • D it outputs 2
Explanation

Sub_A.make() returns the integer 1, while Sub_B inherits Super.make(), which implicitly returns None. Adding an integer to None raises a TypeError.

Community Discussion

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