oop in python inheritance and polymorphism inheritance and polymorphism this is very important concept in python you must understand it better if you want to learn inheritance one of the major advantages of object oriented programming is re-use inheritance is one of the mechanisms to achieve the same inheritance allows programmer to create general or base class first and then later extend it to more specialized class it allows programmer to write better code using inheritance you can use or inherit all the data fields and methods available in your base class later you can add you own methods and data fieldsthus inheritance provides way to organize coderather than rewriting it from scratch in object-oriented terminology when class extend class ythen is called super/parent/base class and is called subclass/child/derived class one point to note here is that only data fields and method which are not private are accessible by child classes private data fields and methods are accessible only inside the class syntax to create derived class isclass baseclassbody of base class class derivedclass(baseclass)body of derived class inheriting attributes now look at the below example