Inheritance in Python - LearnHowToCode SarkariResult.com Interview Questions and Answers LearnHowToCodeOnline
Inheritance in Python

Inheritance in Python

What is Inheritance

Inheritance is a feature of Object Oriented Programming. It is used to specify that one class will get most or all of its features from its parent class. It is a very powerful feature which facilitates users to create a new class with a few or more modification to an existing class. The new class is called child class or derived class and the main class from which it inherits the properties is called base class or parent class.
The child class or derived class inherits the features from the parent class, adding new features to it. It facilitates re-usability of code
Image representation:
Image representation1 Image representation2

Python Inheritance Example

class Animal:   
    def eat(self):  
      print 'Eating...'  
class Dog(Animal):     
   def bark(self):  
      print 'Barking...'  
d=Dog() 
d.eat() 
d.bark()  

About Mariano

I'm Ethan Mariano a software engineer by profession and reader/writter by passion.I have good understanding and knowledge of AngularJS, Database, javascript, web development, digital marketing and exploring other technologies related to Software development.

0 comments:

Featured post

Political Full Forms List

Acronym Full Form MLA Member of Legislative Assembly RSS Really Simple Syndication, Rashtriya Swayamsevak Sangh UNESCO United Nations E...

Powered by Blogger.