Multiple choice technology programming languages

What does the keyword virtual mean in the method definition?

  1. The method is public

  2. The method can be derived

  3. The method is static

  4. The method can be over-ridden

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

The virtual keyword marks a method as able to be overridden in derived classes. It allows the most derived implementation to be called even when referencing the base class (polymorphism). A virtual method is not automatically public (access is separate), not static (static methods cannot be virtual), and "derived" is vague - the key concept is overriding.