And Now, We’re going to talk about the Concepts of Object-Oriented Programming, let’s at first know:
What Is an Object ?
An object is simply can be defined as a “thing” that can perform a set of related activities and these activities defines the Object’s Behavior.
For Example: A hand(Object) can grip something.
…and we should know also:
What Is a Class ?
A class is simply a representation of a type of an object, It is the blueprint/ plan/ template that describe the details of an object, A class is the blueprint from which the individual objects are created, Class is composed of three things:
a name, attributes, and operations.
…and know let’s know what are the Concepts of OOP ?
They’re mainly four concepts:
Abstraction, Encapsulation, Inheritance, and Polymorphism.
and now let’s define each concept….
What is Abstraction ?
Abstraction is an emphasis on the idea, qualities and properties rather than the particulars (a suppression of detail). The importance of abstraction is derived from its ability to hide irrelevant details and from the use of names to reference objects. Abstraction is essential in the construction of programs. It places the emphasis on what an object is or does rather than how it is represented or how it works. Thus, it is the primary means of managing complexity in large programs.
What is Encapsulation ?
The encapsulation is the inclusion within a program object of all the resources need for the object to function – basically, the methods and the data. In OOP the encapsulation is mainly achieved by creating classes, the classes expose public methods and properties. The class is kind of a container or capsule or a cell, which encapsulate the set of methods, attribute and properties to provide its indented functionalities to other classes. In that sense, encapsulation also allows a class to change its internal implementation without hurting the overall functioning of the system. That idea of encapsulation is to hide how a class does it but to allow requesting what to do.
What is Inheritance ?
Ability of a new class to be created, from an existing class by extending it, is called inheritance.
What is Polymorphism ?
Polymorphism is a generic term that means ‘many shapes’. More precisely Polymorphism means the ability to request that the same operations be performed by a wide range of different types of things. At times, In OOP the polymorphisms is achieved by using many different techniques named method overloading, operator overloading and method overriding.
…and know we’ve already know the concepts of OOP.
and here’s a PPT brief about OOP Concepts. 🙂
Stay Tuned, to know more 🙂