C Sharp (C#) - InheritanceWhat is the main purpose of a base class in C#?ATo hold common code that other classes can reuseBTo create objects directly without inheritanceCTo prevent other classes from inheritingDTo store data only without any methodsCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand the role of base classA base class contains common code that multiple classes can share to avoid repetition.Step 2: Compare options with this roleTo hold common code that other classes can reuse matches this purpose exactly, while others describe incorrect or unrelated uses.Final Answer:To hold common code that other classes can reuse -> Option AQuick Check:Base class = shared code [OK]Quick Trick: Base class shares code for reuse [OK]Common Mistakes:MISTAKESThinking base class cannot be instantiatedConfusing base class with interfaceBelieving base class only stores data
Master "Inheritance" in C Sharp (C#)9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More C Sharp (C#) Quizzes Classes and Objects - Methods that operate on state - Quiz 6medium Classes and Objects - Constructors and initialization - Quiz 2easy File IO - File paths and Directory operations - Quiz 4medium Inheritance - Sealed classes and methods - Quiz 5medium Interfaces - Interface vs abstract class decision - Quiz 9hard LINQ Fundamentals - Select clause projection - Quiz 7medium Polymorphism and Abstract Classes - Runtime polymorphism execution - Quiz 13medium Properties and Encapsulation - Init-only setters - Quiz 9hard Properties and Encapsulation - Properties vs fields - Quiz 15hard Strings and StringBuilder - String creation and literal types - Quiz 4medium