Computer Science, asked by ficjcci, 1 year ago

Define inheritance and polymorphism.​

Answers

Answered by Anonymous
4

Inheritance is the process by which objects of one class can link and share some common properties of objects from another class.

Eg- The figure circle is a part of the class two-dimentional, which in turn is a part of the class mensuration.

Polymorphism is the process of using a function for more than one purpose.

Answered by TheFairyTale
69

</p><p>\huge{\purple{\underline{\underline{\pink{Answer:-}}}}}

 \huge{\red{Inheritance}}

One of the major advantages of Object Oriented Programming is re-use. Inheritance is one of the mechanisms to achieve the same. Inheritance allows programmer to create a general or a base class first and then later extend it to more specialized class. It allows programmer to write better code.

Using inheritance you can use or inherit all the data fields and methods available in your base class. Later you can add you own methods and data fields, thus inheritance provides a way to organize code, rather than rewriting it from scratch.

 \huge{\red{polymorphism}}

Polymorphism is an important feature of class definition in Python that is utilized when you have commonly named methods across classes or subclasses. This permits functions to use entities of different types at different times. So, it provides flexibility and loose coupling so that code can be extended and easily maintained over time.

This allows functions to use objects of any of these polymorphic classes without needing to be aware of distinctions across the classes.

Polymorphism can be carried out through inheritance, with subclasses making use of base class methods or overriding them.

Similar questions