• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 12. Objects and Classes > Classes and Object-Oriented Programming

12.5. Classes and Object-Oriented Programming

It's not uncommon to create dozens of complex objects that store rich information about everything from products in a shopping-cart system to bad guys with artificial intelligence in a video game. To expedite the creation of objects and to define object hierarchies (relationships between objects), we use object classes. A class is a template-style definition of an entire category of objects. As you learned in the introduction to this chapter, classes describe the general features of a specific breed of objects, such as "all dogs bark."

12.5.1. Object Classes

Are you ready to get your hands dirty? Let's create a custom Ball class. The first step in class creation is designing the properties and methods the class supports. Our Ball class will have the following properties:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint