appendix classes the latter is obtained using the getbibentry(method note that we have this method returning string that contains the codetitleand authorwhich can be used as part of each entry but this operation will have to be overridden by each entry type in order to produce correctly formatted representation for the given type nextwe define the book classwhich will be used to represent book sources within our bibliography it is derived from the publication class since it is more specific type of publication book entry will contain two additional pieces of information in addition to that contained in the publication classthe name of the publisher and the year of publication class bookpublication )def __init__selfcodetitleauthorpublisheryear )super(__init__codetitleauthor self _publisher publisher self _year year def getbibentryself return super(getbibentry('self _publisher 'self _year constructor is also defined for this class that includes parameters for all of the data to be contained in book entry each class is responsible for initializing its own data attributes thusnote the first line in the body of the constructor that is used to call the constructor of the parent class that constructor requires three argumentscodetitleand author after the parent class creates and initializes its own attributeswe can then create and initialize two new attributes needed by the child class the child class also overrides the getbibentry(method from the parent class in order to build and return string containing the bibliography entry for book source our implementation calls the parent' version of the getbibentry(method in order to format the codetitleand author part of the bibliography entry for book creating class instances so what happens when we create an instance of the book classconsider the following code segmentpub publication"test ""just test""rob greenbook book"smith ""the year that was""john smith""bookends publishing" which creates an instance of the publication class and an instance of the book class the pub object only contains the three data fields defined by the publication classwhile the book object contains all five fieldsthe three from the parent class and the two defined in the book class figure illustrates the contents