class tree heresecondclass redefines and so customizes the "displaymethod for its instances secondclass defines the display method to print with different format by defining an attribute with the same name as an attribute in firstclasssecondclass effectively replaces the display attribute in its superclass recall that inheritance searches proceed upward from instances to subclasses to superclassesstopping at the first appearance of the attribute name that it finds in this casesince the display name in secondclass will be found before the one in first classwe say that secondclass overrides firstclass' display sometimes we call this act of replacing attributes by redefining them lower in the tree overloading the net effect here is that secondclass specializes firstclass by changing the behavior of the display method on the other handsecondclass (and any instances created from itstill inherits the setdata method in firstclass verbatim let' make an instance to demonstratez secondclass( setdata( display(current value " finds setdata in firstclass finds overridden method in secondclass as beforewe make secondclass instance object by calling it the setdata call still runs the version in firstclassbut this time the display attribute comes from second class and prints custom message figure - sketches the namespaces involved nowhere' crucial thing to notice about oopthe specialization introduced in secondclass is completely external to firstclass that isit doesn' affect existing or future firstclass objectslike the from the prior examplex display(new value is still firstclass instance (old messagerather than changing firstclasswe customized it naturallythis is an artificial examplebut as rulebecause inheritance allows us to make changes like this in external components ( in subclasses)classes often support extension and reuse better than functions or modules can classes are customized by inheritance