Page 358 - Beginning Programming with Pyth - John Paul Mueller
P. 358
The example code begins by importing the BPPD_15_MyClass package. The package name is the name of the file used to store the external code, not the name of the class. A single package can contain multiple classes, so always think of the package as being the actual file that is used to hold one or more classes that you need to use with your application.
After the package is imported, the application creates two MyClass objects. Notice that you use the package name first, followed by the class name. The first object, SamsRecord, uses the default settings. The second object, AmysRecord, relies on custom settings.
Sam has become a year old. After the application verifies that the age does need to be updated, it updates Sam's age.
Somehow, HR spelled Aimeeās name wrong. It turns out that Amy is an incorrect spelling. Again, after the application verifies that the name is wrong, it makes a correction to AmysRecord. The final step is to print both records in their entirety.
2. Click Run Cell.
The application displays a series of messages as it puts MyClass through its paces, as shown in Figure 15-14. At this point, you know all the essentials of creating great classes.
FIGURE 15-14: The output shows that the class is fully functional.