polymorphism the third concept related to object-oriented programming is that of polymorphism it is very powerful feature in which the decision as to the specific method to be called is made at run time suppose we add the str method to our publication class and simply have it call and return the result of the getbibentry(method as shown herenew version with __str__ method added class publicationobject def __init__selfcodetitleauthor )self _code code self _title title self _author author gets the unique identification code for this entry def getcodeself )return self _code returns string containing formatted bibliography entry def getbibentryself )return '[self getcode('"self _title 'by self _author def __str__self )return self getbibentry(rememberwhen an object is used within the print(functionthe str operator method is automatically called for that object so what happens if we print the pub and book objects created earlierprintpub printbook this results in the following output[test '"just testby rob green [smith "the year that wasby john smithbookends publishing but how is that possible since we did not define str method for the book classit has to do with polymorphism since the str method is defined by the parent classit will be inherited by the child class thuswhen the str method is executed via the print functionprintbook python looks at the list of methods available to instances of the book class and finds the getbibentry(method defined for that class and executes it thusthe str method correctly calls the getbibentry(method of the child classeven though the str method was defined in the parent class