Chapter 7 – Implementing Interfaces and Inheriting Classes

  1. How is a base class and a derived class related?

    A derived class (or subclass) is a class that inherits from a base class (or superclass).

  2. What is the difference between the is and as operators?

    The is operator returns true if an object can be cast to the type. The as operator returns a reference if an object can be cast to the type; otherwise, it returns null.

  3. Which keyword is used to prevent a class from being derived from, or a method from being overridden?
    sealed

    Find more information on the sealed keyword at https://msdn.microsoft.com/en-us/library/88c54tsw.aspx.

  4. Which keyword is used to prevent a class from being instantiated with the new keyword or force a method to be overridden?
    abstract ...

Get C# 6 and .NET Core 1.0: Modern Cross-Platform Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.