Recall & Review
beginner
What is a base class in C#?A base class is a class that provides common properties and methods which other classes (derived classes) can inherit and reuse.Click to reveal answer
beginner
What does it mean for a class to be derived from a base class?A derived class inherits members (properties and methods) from the base class and can add its own members or override existing ones.Click to reveal answer
beginner
How do you declare a derived class in C#?Use a colon (:) after the class name followed by the base class name. Example: <code>class Dog : Animal { }</code>Click to reveal answer
intermediate
Can a derived class access private members of its base class?No, private members of a base class are not accessible directly by derived classes. They can access protected or public members.Click to reveal answer
intermediate
What is method overriding in the context of base and derived classes?
Method overriding allows a derived class to provide a new implementation of a method defined in the base class using the <code>override</code> keyword.Click to reveal answer
Which keyword is used to inherit from a base class in C#?
✗ Incorrect
In C#, the colon (:) is used to indicate inheritance from a base class.
If class B derives from class A, which members can B access directly?
✗ Incorrect
Derived classes can access public and protected members of the base class, but not private members.
What keyword must be used in the base class method to allow overriding?
✗ Incorrect
The base class method must be marked with 'virtual' to allow derived classes to override it.
Which keyword is used in the derived class to override a base class method?
✗ Incorrect
The 'override' keyword is used in the derived class to provide a new implementation of a base class method.
What happens if a derived class does not override a virtual method?
✗ Incorrect
If a derived class does not override a virtual method, the base class version is used by default.
Explain how inheritance works between a base class and a derived class in C#.
Think about how a child inherits traits from a parent.
You got /3 concepts.
Describe the difference between private, protected, and public members in the context of base and derived classes.
Consider who can see or use each member.
You got /3 concepts.