Simple, Quality, Awesome Software

Inheritance Quiz

Below are the answers to the Inheritance Quiz, along with a brief discussion.

1. True.

2. False. Most things can, but if they’re marked private, they still won’t be accessible in the derived class. If you want something to be accessible in the base class and any derived class, use the protected accessibility level instead.

3. False. Value types can’t do inheritance.

4. True. All classes are derived from the object class, even without explicitly declaring a base class. This means that any method in the object class can be used by any and every type.

5. True. You can have multiple layers of inheritance, so a class can be both derived from another class, and the base class for a third class.

6. True. This can be done with the sealed keyword.