C Sharp (C#) - Polymorphism and Abstract ClassesWhy does C# use a virtual method dispatch mechanism instead of static method calls for virtual methods?ATo enable runtime polymorphism and call the correct override based on object type.BTo improve compile-time performance by avoiding method lookups.CTo prevent derived classes from overriding base methods.DTo enforce method hiding instead of overriding.Check Answer
Step-by-Step SolutionSolution:Step 1: Understand purpose of virtual dispatchVirtual dispatch allows the program to decide at runtime which method implementation to call based on the actual object type.Step 2: Contrast with static callsStatic calls are fixed at compile-time and cannot support polymorphism, which is essential for flexible object-oriented design.Final Answer:To enable runtime polymorphism and call the correct override based on object type. -> Option AQuick Check:Virtual dispatch enables runtime polymorphism [OK]Quick Trick: Virtual dispatch enables runtime method selection [OK]Common Mistakes:MISTAKESThinking virtual dispatch improves compile-time speedBelieving it prevents overridingConfusing hiding with overriding
Master "Polymorphism and Abstract Classes" in C Sharp (C#)9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More C Sharp (C#) Quizzes Collections - Collection initialization syntax - Quiz 10hard Collections - List generic collection - Quiz 9hard File IO - File class static methods - Quiz 10hard File IO - File class static methods - Quiz 14medium Interfaces - Implementing interfaces - Quiz 6medium Interfaces - Why interfaces are needed - Quiz 13medium Interfaces - Explicit interface implementation - Quiz 8hard LINQ Fundamentals - Aggregate functions (Count, Sum, Average) - Quiz 2easy LINQ Fundamentals - GroupBy operation - Quiz 2easy LINQ Fundamentals - GroupBy operation - Quiz 7medium