What are inheritance and polymorphism? (Specification and implementation)

--Originally published at diegotc2016

Inheritance is when a class, which is called the sub class, has the main elements of another class (super class) and has another one or more. For example:

Class: Person Class: PersonTwo
Name

Age

Height

Name

Age

Height

Weight

Polymorphism means the many uses or functionalities an object ar operator or a class can have. For example:

a=4

b=5

Then you want to print a+b your output will be 9

a=”4”

b=”5”

Then you want to print a+b your output will be “45”

I got this out of object oriented course at lynda.com

What are inheritance and polymorphism? (Specification and implementation)


What are inheritance and polymorphism? (Specification and implementation)