< Day Day Up > |
We have already discussed in great detail object-oriented (OO) concepts and the difference between the interface and the implementation. No matter how well you think out the problem of what should be an interface and what should be part of the implementation, the bottom line always comes down to how useful the class is and how it interacts with other classes. A class should never be designed in a vacuum , for as might be said, no class is an island. When objects are instantiated , they almost always interact with other objects. An object can also be used within another object, or be inherited. The following section is a bit of a dissection of a class, and the rest of the chapter offers some guidelines that you should consider when designing classes. In this chapter we'll examine a simple class and then take it apart piece by piece. We will continue using the cabbie example presented in Chapter 2, "How to Think in Terms of Objects." In this chapter, we'll discuss the following parts of a class:
Only a Template This class is meant for illustration purposes only. Some of the methods are not fleshed out (meaning that there is no implementation) and simply present the interface. |
< Day Day Up > |