Chapter 4. Object-Oriented Programming in C

for RuBoard

Chapter 4. Object-Oriented Programming in C #

In this chapter we study in detail the object-oriented aspects of C#, with an emphasis on inheritance. First we review the fundamentals of object-oriented programming. Next, the Acme Travel Agency case study is introduced. This case study is developed throughout the entire book, as we explain more about .NET. We consider some abstractions that will enable us to implement a reservation system for a variety of resources, and we provide an implementation of a hotel reservation system. The abstract base classes we define provide reusable code that enables us to easily implement other kinds of reservation systems. The key is finding the right abstractions.

We will see how C# language features facilitate object-oriented programming. Certain details of C#, such as use of access control (public, private, and protected) and properties can help express abstractions in a way that is safe and easy to use. We will then look at other object-oriented features of C#, such as virtual methods , method hiding, method overriding, and polymorphism. A problem in languages supporting inheritance is the fragile base class problem, and we will see how C# helps in avoiding this pitfall.

This chapter is very much driven by our case study. We introduce object-oriented features of C# as we elaborate the case study. At the end of the chapter we cover additional concepts not illustrated by the case study.

for RuBoard


Application Development Using C# and .NET
Application Development Using C# and .NET
ISBN: 013093383X
EAN: 2147483647
Year: 2001
Pages: 158

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net