Simple Inheritance implementation in Python


In this article, we have demonstrated a simple Python Program which implements Inheritance.

Inheritance example in Python


class Person: def __init__(self,first,last): self.first_name = first self.last_name = last def name(self): return self.first_name + " " + self.last_name class Employee(Person): def __init__(self,first,last,age): Person.__init__(self,first,last) self.age = age def GetEmployeeDetails(self): return "Name:" + + " Age:" + self.age if __name__ == '__main__': first = raw_input("Enter your first name") last = raw_input("Enter your last name") age = raw_input("Enter your age") x = Person(first,last) y = Employee(first,last,age) print( print(y.GetEmployeeDetails())


Enter your first name baburao Enter your last name apte Enter your age20 baburao apte Name: baburao apte Age:20

Algorithm Logic Test

Our Quiz prepared by Experts Helps you identify your knowledge in Algorithms. Everyone should atleast attempt this Quiz Once. 

Need any help in Programming? Chat with Us


Online Compiler
Algorithm Quiz

Only 5% Users were able to score above 75% in this Quiz. Can You Crack this?

Deals Ends in

Online Games
Play 2048 Game Online and Relax.
Play 2048 Game Online

Search Tags