Fundamentals of Computer Programming with C# HTML version
Chapter 20. Object-Oriented
In This Chapter
In this chapter we will familiarize ourselves with the principles of object-
oriented programming: class inheritance, interface implementation,
abstraction of data and behavior, encapsulation of data and class
implementation, polymorphism and virtual methods. We will explain in
details the principles of cohesion and coupling. We will briefly outline
object-oriented modeling and how to create an object model based on a
specific business problem. We will familiarize ourselves with UML and its role
in object-oriented modeling. Finally, we will briefly discuss design patterns
and illustrate some of those that are widely used in practice.
Let’s Review: Classes and Objects
Classes are a description (model) of real objects and events referred to as
entities. An example would be a class called "Student".
Classes possess characteristics – in programming they are referred to as
properties. An example would be a set of grades.
Classes also expose behavior known in programming as methods. An
example would be sitting an exam.
Methods and properties can be visible only within the scope of the class,
which declared them and their descendants (private / protected), or visible
to all other classes (public).
Objects are instances of classes. For example, John is a Student and Peter
is also a Student.
Object-Oriented Programming (OOP)
Object-oriented programming is the successor of procedural (structural)
programming. Procedural programming describes programs as groups of
reusable code units (procedures) which define input and output parameters.
Procedural programs consist of procedures, which invoke each other.