object-oriented programming inheritance in object-oriented programming there is concept called inheritance where you can create class that builds off of another class when you do thisthe new class gets all of the variables and methods of the class it is inheriting from (called the base classit can then define additional variables and methods that are not present in the base classand it can also override some of the methods of the base class that isit can rewrite them to suit its own purposes here is simple exampleclass parentdef __init__(selfa)self def method (self)return self * def method (self)return self '!!class child(parent)def __init__(selfab)self self def method (self)return self * def method (self)return self self parent'hi ' child'hi ''bye 'print'parent method ' method ()print'parent method ' method ()print(print'child method ' method ()print'child method ' method ()print'child method ' method ()parent method hihi parent method hi!!child method hihihihihihihi child method hi!!child method hibye we see in the example above that the child has overridden the parent' method causing it to now repeat the string seven times the child has inherited the parent' method so it can use it without having to define it the child also adds some features to the parent classnamely new variable and new methodmethod note about syntaxwhen inheriting from classyou indicate the parent class in parentheses in the class statement