Python Programming with the Java™ Class Libraries: A Tutorial for Building Web and Enterprise Applications with Jython
by Richard Hightower
Objects and Classes
Objects in the real world are made up of many other objects (in OOP speak this is called aggregation or containment). For example, a car object contains tire objects, an engine object, a steering system object, a breaking system object, and so forth. Organizing a program into a hierarchy of objects helps us conceptualize it. Essentially, you break down the program into interrelated objects, which are in turn broken down into other objects. This is called inheritance.
A class is a template for creating objects by defining their behavior and attributes. Thus, a car class defines the behaviors of a car, such as
Moving forward or backward
Breaking
Turning
It also defines the car's attributes, such as
Make
Model
Color
Year
Two door or ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access