Chapter 2. Class Design

A class represents an abstraction, usually of our application domain. In computer graphics, for example, we manipulate classes representing lights, a camera, geometric shapes such as a sphere, cone, or cube, as well as curves and surfaces, and math classes such as matrices and vectors. In the design of a Windows application, we manipulate classes representing text boxes, buttons, labels, message boxes, and so on. The primary goal of this chapter is to familiarize you with the C# language support for designing and implementing classes.

In general, a class consists of two parts: a public set of operations and properties—called the public interface—and a private implementation. As users of a class, we are consumers of its public interface. For example, as users we know that to retrieve the number of elements currently held within an ArrayList object, we access its Count property. That's the public interface. Whether that value is stored as a data member or calculated on demand and cached is an implementation detail that is hidden from us as users. A secondary goal of this chapter is to look at how we separate interface and implementation in the design of our classes.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.209.131