ABSTRACT

This chapter introduces object-oriented programming in regard to Python's programming language, classes and objects, object generation, inheritance, GIS classes and objects, and a general programming experience. It also introduces three important relationships among objects in object-oriented programming: inheritance, encapsulation, and polymorphism. The chapter discusses object-oriented programming as well as how to program objects, classes, and relationships. Classes and objects are widely used in Python. Python provides the mechanism to define a class using the keyword class with the syntax of 'class className:'. The chapter explains how attributes can be public, private, or protected to indicate different accessibility by other objects. It shows how to define a class and how to create objects using Point, Polyline, and Polygon. The chapter explains how to inherit super classes and how to reuse the code and its necessary functions.