O'Reilly logo

C# Primer: A Practical Approach by Stanley B. Lippman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3. Object-Oriented Programming

The primary use of a class is to introduce a new type that more directly represents an entity in our application. In a library checkout application, for example, it is generally easier to program the classes Book, Borrower, and DueDate directly than to translate the program logic to the underlying character, arithmetic, and Boolean data types.

A programming model based on unrelated classes proves cumbersome when an application begins to be filled with class types that represent is-a-kind-of instances of another class type. For example, imagine that over time our library checkout application must add support for a RentalBook class, an AudioBook class, and an InteractiveBook class in addition to the original ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required