Chapter 2
Object-Oriented Programming
Contents
2.1 Goals, Principles, and Patterns
2.1.1 Object-Oriented Design Goals
2.1.2 Object-Oriented Design Principles
2.2.3 Coding Style and Documentation
2.3.1 Example: CreditCard Class
2.3.2 Operator Overloading and Python's Special Methods
2.3.3 Example: Multidimensional Vector Class
2.4.1 Extending the CreditCard Class
2.4.2 Hierarchy of Numeric Progressions
2.5 Namespaces and Object-Orientation
2.5.1 Instance and Class Namespaces
2.1 Goals, Principles, and Patterns
As the name implies, the main “actors” in the object-oriented paradigm are called objects. Each object is an instance of a class. Each class presents to the outside world a concise and consistent view of the objects that are instances of this class, without going into too much unnecessary detail or giving others access to the inner workings of the objects. The class definition typically specifies instance variables, also known as data members, that the object contains, as well as the methods, also known as member functions, that the object can execute. This view of computing ...
Get Data Structures and Algorithms in Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.