Python inheritance

Inheritance is one of the OOP(Object Oriented Programming) Concept. It involves a parent and child class. A class is created and its member functions are defined. This class is called base class or parent class. When you want a copy of base class, you can inherit it and create a child class. A child class is simply a replica of base class. 1)Here, a base class is created with name " customer" class customer: def __init__(cust, fname, lname): cust.firstname = fname cust.lastname = lname def printfullname(cust): print(cust.firstname, cust.lastname) #Use the customer class to create an object, and then execute the printfullname method: x = customer("jeev", "anand") x.printfullname() 2) A child class “Regularcustomer” is created. #Creating a child class Regularcustomer class Regularcustomer(customer): pass # pass denotes this class doesnot have any d...