tree abstract base class in python in discussing the object-oriented design principle of abstraction in section we noted that public interface for an abstract data type is often managed in python via duck typing for examplewe defined the notion of the public interface for queue adt in section and have since presented several classes that implement the queue interface ( arrayqueue in section linkedqueue in section circularqueue in section howeverwe never gave any formal definition of the queue adt in pythonall of the concrete implementations were self-contained classes that just happen to adhere to the same public interface more formal mechanism to designate the relationships between different implementations of the same abstraction is through the definition of one class that serves as an abstract base classvia inheritancefor one or more concrete classes (see section we choose to define tree classin code fragment that serves as an abstract base class corresponding to the tree adt our reason for doing so is that there is quite bit of useful code that we can provideeven at this level of abstractionallowing greater code reuse in the concrete tree implementations we later define the tree class provides definition of nested position class (which is also abstract)and declarations of many of the accessor methods included in the tree adt howeverour tree class does not define any internal representation for storing treeand five of the methods given in that code fragment remain abstract (rootparentnum childrenchildrenand len )each of these methods raises notimplementederror ( more formal approach for defining abstract base classes and abstract methodsusing python' abc moduleis described in section the subclasses are responsible for overriding abstract methodssuch as childrento provide working implementation for each behaviorbased on their chosen internal representation although the tree class is an abstract base classit includes several concrete methods with implementations that rely on calls to the abstract methods of the class in defining the tree adt in the previous sectionwe declare ten accessor methods five of those are the ones we left as abstractin code fragment the other five can be implemented based on the former code fragment provides concrete implementations for methods is rootis leafand is empty in section we will explore general algorithms for traversing tree that can be used to provide concrete implementations of the positions and iter methods within the tree class the beauty of this design is that the concrete methods defined within the tree abstract base class will be inherited by all subclasses this promotes greater code reuseas there will be no need for those subclasses to reimplement such behaviors we note thatwith the tree class being abstractthere is no reason to create direct instance of itnor would such an instance be useful the class exists to serve as base for inheritanceand users will create instances of concrete subclasses