ABSTRACT

The basic idea of object-oriented programming (OOP) is that we use objects to model real-world things that are represented inside programs and provide a simple way to access their functionality that would otherwise be hard or impossible to utilize. Large programs are challenging to write. Once a program reaches a certain size, object-oriented programs are easier to understand and much easier to modify and maintain than a non-object-oriented program. So, object-oriented programs require less work to maintain. OOP results in code reuse, cleaner code, better architecture, abstraction layers and fewer programming bugs. Python provides full support for OOP, including encapsulation, inheritance and polymorphism. This chapter explores the classes, new objects, class inheritance, encapsulation and polymorphism used in Python.