Implementing Interfaces and Inheriting Classes

This chapter is about deriving new types from existing ones using object-oriented programming (OOP). You will learn about defining operators and C# 7 local functions for performing simple actions, delegates and events for exchanging messages between types, implementing interfaces for common functionality, inheriting from a base class to create a derived class to reuse functionality, overriding a type member, using polymorphism, creating extension methods, and casting between classes in an inheritance hierarchy.

This chapter covers the following topics:

  • Setting up a class library and console application
  • Simplifying methods with operators
  • Defining local functions
  • Raising and handling events

Get C# 7.1 and .NET Core 2.0 – Modern Cross-Platform Development - Third Edition 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.