Summary


This chapter introduced you to a different way of programming by using the software object. You learned that software objects can combine functions and data (methods and attributes in OOP-speak) and in many ways mimic real-world objects. You saw how to write classes, the blueprints of objects. You learned about a special method called the constructor that is automatically invoked when a new object is instantiated. You saw how to create and initialize object attributes through a constructor. You learned how to create class-wide elements such as class attributes and static methods. Next, you learned about object encapsulation. You saw ways to help ensure encapsulation, including the use of private attributes. But you learned that, more than anything, good object design is the best way to help ensure encapsulation. Finally, you saw all of these ideas put to work to create a demanding virtual pet that requires constant attention.




Python Programming for the Absolute Beginner
Python Programming for the Absolute Beginner, 3rd Edition
ISBN: 1435455002
EAN: 2147483647
Year: 2003
Pages: 194

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net