Difficulty: Easy
Correct Answer: 1, 3, 5
Explanation:
Introduction / Context:
This question surveys several foundational truths about inheritance in C#. Understanding what is included in a derived object, accessibility of base data, and construction order is essential.
Given Data / Assumptions:
override
/new
and adding members.
Concept / Approach:
A derived object physically contains base-class instance fields. It may not be able to access some of them (like private
) even though they exist. Construction runs base → derived. Derived classes can both extend and override base functionality.
Step-by-Step Solution:
private
base members are not accessible in the derived type.(4) False — derived types can add new members (extend functionality).(5) True — base constructor executes before derived constructor.
Verification / Alternative check:
Reflect a derived instance; you will see fields from the base. Attempt to access a private
base field from the derived → compile error.
Why Other Options Are Wrong:
They include (2) or (4), both of which misstate how overriding and class extension work.
Common Pitfalls:
Equating “not accessible” with “does not exist.” The data exists in the object even if not accessible by name in code.
Final Answer:
1, 3, 5
Discussion & Comments