4Object-Oriented Programming with C#


C# is not a pure object-oriented programming language. C# offers multiple programming paradigms. However, object orientation is an important concept with C#, and it’s a core principle of all the libraries offered by .NET.

The three most important concepts of object-orientation are inheritance, encapsulation, and polymorphism. Chapter 3, “Objects and Types,” talks about creating individual classes to arrange properties, methods, and fields. When members of a type are declared private, they cannot be accessed from the outside. They are encapsulated within the type. This chapter’s focus is on inheritance and polymorphism.

The previous chapter also explains that all classes ultimately derive from the class System.Object. This chapter covers how to create a hierarchy of classes and how polymorphism works with C#. It also describes all the C# keywords related to inheritance.


Let’s ...

Get Professional C# 7 and .NET Core 2.0, 7th Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.