nerdexam
Microsoft

98-361 · Question #130

This question requires that you evaluate the underlined text to determine if it is correct. When a base class declares a method as virtual, the method is hidden from implementation bv a derived…

The correct answer is B. can be overridden with its own implementation by a derived class. The implementation of a non-virtual method is invariant: The implementation is the same whether the method is invoked on an instance of the class in which it is declared or an instance of a derived class. In contrast, the implementation of a virtual method can be superseded by…

Understanding Object-Oriented Programming

Question

This question requires that you evaluate the underlined text to determine if it is correct. When a base class declares a method as virtual, the method is hidden from implementation bv a derived class. Select the correct answer if the underlined text does not make the statement correct. Select "No change is needed'' if the underlined text makes the statement correct.

Options

  • ANo change is needed
  • Bcan be overridden with its own implementation by a derived class
  • Cmust be overridden in any non-abstract class that directly inherits from that class
  • Dcannot be overridden with its own implementation by a derived class

How the community answered

(40 responses)
  • A
    5% (2)
  • B
    75% (30)
  • C
    8% (3)
  • D
    13% (5)

Explanation

The implementation of a non-virtual method is invariant: The implementation is the same whether the method is invoked on an instance of the class in which it is declared or an instance of a derived class. In contrast, the implementation of a virtual method can be superseded by derived classes. The process of superseding the implementation of an inherited virtual method is known as overriding that method.

Topics

#virtual methods#method overriding#inheritance#derived class

Community Discussion

No community discussion yet for this question.

Full 98-361 Practice