Summary

  • Object-oriented programming helps programmers manage complexity by modeling essential aspects of the real-world problem.

  • A class defines a new type in your program and is typically used as a representation for a type of thing in the problem domain.

  • An object is an instance of a class.

  • State is the current condition of an object.

  • Many classes define member fields, which are typically private variables visible to every method of the class, but not outside the class.

  • The behavior of the class is defined with methods, which contain code to perform an action. Methods can manipulate the state of the object and interact with other objects.

  • The three pillars of object-oriented programming are encapsulation, specialization, and polymorphism.

  • Encapsulation requires that each class should be discrete and self-contained. Each class should “know” or “do” one discrete thing or set of things.

  • Specialization is implemented by deriving more specific classes from generalized (base) classes through inheritance.

  • Polymorphism allows you to treat a collection of objects of types, all derived from a common base, as though each was an instance of that base type.

  • Analysis is the process of detailing the problem you’re trying to solve.

  • Design is the planning of the solution to the problem.

This chapter was a bit of a departure from what we’ve been teaching you so far. We got away from the hands-on code to talk in broader terms about object-oriented programming and the theory behind it. That’s an indication of ...

Get Learning C# 3.0 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.