define the following with an example each.(a) inheritance ( b) polymorphism
Answers
Answer:
1)inheritance:
Generally speaking, objects are defined in terms of classes. You know a lot about an object by knowing its class. Even if you don't know what a penny-farthing is, if I told you it was a bicycle, you would know that it had two wheels, handle bars, and pedals.
Object-oriented systems take this a step further and allow classes to be defined in terms of other classes. For example, mountain bikes, road bikes, and tandems are all kinds of bicycles. In object-oriented terminology, mountain bikes, road bikes, and tandems are all subclasses (in the glossary) of the bicycle class. Similarly, the bicycle class is the superclass (in the glossary) of mountain bikes, road bikes, and tandems. This relationship is shown in the following figure.
2)polymorbhism:
In object-oriented programming, polymorphism (from the Greek meaning "having multiple forms") is the characteristic of being able to assign a different meaning or usage to something in different contexts - specifically, to allow an entity such as a variable, a function, or an object to have more than one form.
Answer:
Hi friend ,ningal ente answers like cheythal,njan ningalude ella answers um like cheyyam