How it works...

We can see that inheritance allows us to easily extend our classes by reusing functionality that already exists within another class created earlier. You also need to be aware though that any changes to the SpaceShip class will be inherited, all the way up to the top-most derived class.

Inheritance is a very powerful feature of C# that allows developers to write less code, and reuse working and tested methods.

Get C# 7 and .NET Core Cookbook 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.