5.5. Defining the Pillars of OOP

All object-based languages (C#, Java, C++, Smalltalk, Visual Basic, etc.) must contend with three core principals, often called the pillars of object-oriented programming (OOP):

  • Encapsulation: How does this language hide an object's internal implementation details and preserve data integrity?

  • Inheritance: How does this language promote code reuse?

  • Polymorphism: How does this language let you treat related objects in a similar way?

Before digging into the syntactic details of each pillar, it is important that you understand the basic role of each. Here is an overview of each pillar, which will be examined in full detail over the remainder of this chapter and the next.

5.5.1. The Role of Encapsulation

The first ...

Get Pro C# 2010 and the .NET 4 Platform, Fifth 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.