Content
To be an Object Oriented language, any language must follow at least the four characteristics: Abstraction, Encapsulation, Inheritance and Polymorphism.
Data Abstraction:
Abstraction is a view or representation of an actual item. It is essential properties and actions of an object we are representing. It denotes the essential characteristics of an object that distinguish it from all other kinds of objects. It is a logical boundary around behaviors (methods) and data (properties) they work.
Encapsulation:
In encapsulation representation of data and the implementation details are hidden. The internal workings are hidden, but access is provided via the interfaces – methods. Encapsulation and abstraction are related. Abstraction is more a logical view, while encapsulation is closely related to the physical implementation. Encapsulation, abstracts, hides access to the data and methods are used to access the data. It protects the data via interface implementations. /p>
Inheritance: It allows code reuse. We define a base class, the super class. New classes use the super lass code. The super class is extended, we do not copy and paste existing code but reuse it.
Polymorphism: From the base class, we can create more types of it. Polymorphism is the way of providing the different functionality base on the base class. Polymorphism means multiple form.
Dynamic Binding: This too is related to OO principles. The relationship between the base and sub class can be numerous at runtime. There is a difference in the code we create and how the code gets used at runtime. Usage can be more dynamic than anticipated. The sub classes can be used or related in different ways. Dynamic binding automatically determines which sub class of the base class is used. It’s a safer mechanism to associate and relate code.