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…
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)- A5% (2)
- B75% (30)
- C8% (3)
- D13% (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
Community Discussion
No community discussion yet for this question.