Object Oriented Programming

1) Encapsulation : Binding (or wrapping) data and functions that operate on that data together into a single unit is known as encapsulation.

2) Abstraction: Showing functionality and hiding internal details is known as abstraction.
eg. A database system hides certain details of how data is stored and created and maintained.

3) Inheritance: When one object acquires the properties and behaviors of parent object i.e. known as inheritance.

It provides code reusability. It is used to achieve runtime polymorphism.

eg. Mountain bikes, road bikes, and tandem bikes, for example, all share the characteristics of bicycles (current speed, current pedal cadence, current gear).

4) Polymorphism: refers to the ability of a variable, function or object to take on multiple forms.

Polymorphism could be static and dynamic both. Overloading is static polymorphism while, overriding is dynamic polymorphism.

Overloading in simple words means two methods having same method name but takes  different input parameters. This called static because, which method to be invoked will be decided at the time of compilation

Overriding means a derived class is implementing a method of its super class.

eg. To speak something e.g. cat speaks meaw, dog barks woof

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s