TopDefining New ObjectsDefining Classes

Defining Classes

Classes are used when we need more than one object with the same kind of information and operations. Suppose, for example, that I wanted to have a basketball that could start where ever I wanted to on the screen of any application. (E.g., maybe I want two basketballs to lay next to the laundry baskets in this weeks lab.)

To create multiple objects of the same general kind, we can define a class which can be used to generate objects. We can get from an object to a class with only a few small changes:

At the end of class, we looked at a class to generate Tshirts: Tshirt


TopDefining New ObjectsDefining Classes