![]() An isosceles triangle also IS a triangle.Triangle is a base class (also called parent class), equilateral and isosceles triangles are the inherited classes – also called child classes.Data definitions and methods of parent class are inherited by child class thereby features that are already available can be reused.Child class may define additional functionality or modify a base class method. It shows a triangle which has three sides. Hence, animal is base class while dog and cat are inherited classes.Look at the figure below. ![]() After all, smartphone 'IS A' mobile phone! Similarly dog IS an animal. In OOP terminology, this characteristic is called inheritance, which is the cornerstone of theory of object oriented programming paradigm.Inheritance comes into picture when new class possesses 'IS A' relationship with existing class. In object oriented parlance, it would be said that smartphone inherits the basic feature phone.Almost every object oriented programming language supports extending capability of an existing class to build new class instead of building from scratch. The smart phone, while retaining capabilities of the feature phone added some new features. The basic phone we used nearly a decade and half ago is today upgraded to smartphone. The diagram below illustrates this point. Python Tutorial By KnowledgeHut Normally an older model of a certain product with a basic functionality gets upgraded to an advanced model with additional features and improvements to functionality of basic model.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |