What is Inheritance? tccicomputercoaching.com

Page 1

What is Inheritance? tccicomputercoaching.com 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. Python Inheritance Syntax baseclass as per previous example 1. 2. 3. 4. 5. 6.

class DerivedClassName(BaseClassName): <statement-1> . . . <statement-N> Here we always use object of parent type. object=baseclass() This child type object will call both module of parent and child. TCCI computer coaching institute teach python and other programming Languages in Ahmedabad.


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.