advanced programming techniques we have omitted stack top(and stack __str__(since neither adds anything new and neither interacts with the undo base class for the can_undo property and the undo(methodwe simply pass on the work to the base class if these two were not abstract we would not need to reimplement them at all and the same effect would be achievedbut in this case we wanted to force subclasses to reimplement them to encourage undo to be taken account of in the subclass for push(and pop(we perform the operation and also add function to the undo list which will undo the operation that has just been performed abstract base classes are most useful in large-scale programslibrariesand application frameworkswhere they can help ensure that irrespective of implementation details or authorclasses can work cooperatively together because they provide the apis that their abcs specify multiple inheritance |multiple inheritance is where one class inherits from two or more other classes although python (andfor examplec++fully supports multiple inheritancesome languages--most notablyjava--don' allow it one problem is that multiple inheritance can lead to the same class being inherited more than once ( if two of the base classes inherit from the same class)and this means that the version of method that is calledif it is not in the subclass but is in two or more of the base classes (or their base classesetc )depends on the method resolution orderwhich potentially makes classes that use multiple inheritance somewhat fragile multiple inheritance can generally be avoided by using single inheritance (one base class)and setting metaclass if we want to support an additional apisince as we will see in the next subsectiona metaclass can be used to give the promise of an api without actually inheriting any methods or data attributes an alternative is to use multiple inheritance with one concrete class and one or more abstract base classes for additional apis and another alternative is to use single inheritance and aggregate instances of other classes nonethelessin some casesmultiple inheritance can provide very convenient solution for examplesuppose we want to create new version of the stack class from the previous subsectionbut want the class to support loading and saving using pickle we might well want to add the loading and saving functionality to several classesso we will implement it in class of its ownclass loadsavedef __init__(selffilename*attribute_names)self filename filename self __attribute_names [for name in attribute_namesif name startswith("__")