Basic Concept of Object Oriented Programming [C++ Tutorials – 1]
Object Oriented Programming (OOP) is an approach that provides a way of modulating programs by creating portioned memory area for both data and functions that can be used as templates for creating copies of such modules on demand.
Thus here an object is considered to be a portioned area of computer memory that stores data and set of operations that can access that data. Since the memory portions are independent, the objects can be used in a variety of different programs without modifications.
In this article let us discuss the major and basic concepts of object oriented programming.
Basic Concepts of Object Oriented Programming
To learn a programming language that involves object-oriented programming concept, it is necessary to understand the basic concepts mostly used in OOP. They are described below.
Objects are the most basic element of the object-oriented programming concept. They are the run-time entities which represent a person, or a place, or a data or any such item that the program has to handle.
When you choosing the program objects it should be chosen such that they match closely with the real-world objects.Objects have an associated unique address and occupy s[ace in the memory.
The below figure clears the mostly used two methods of representing objects in OOP analysis and design.
Now we just have learned the objects. An object can be made a user-defined data type with the help of a class. So that objects are the variables of the data type class.Now let me define the class: a class is a collection of objects of similar type.
For example, if a school is a class in OOP concept then the students are the objects of the class school.
In the above example,
An object student_name will create belonging to the class school.
Once a class has been defined, we can create any number of objects belonging to that class, and each object is associated with the data of type class with which they are created.
Data abstraction is the act of representing essential and very important features without including the background details r explanations. Classes use the concept of abstraction and are defined as a list of abstract attributes such as size, weight and cost, and functions to operate on these attributes.
The attributes are also called data members as they hold information and the functions which they operate on these data are called methods or member functions.
Data Encapsulations is the wrapping up of data and functions into a single unit, where the single units are called classes.
The data in the class is not accessible to the outside world, and only these functions which are wrapped in the class can access.
The process by which objects of one class acquire the properties of objects of another class is known as inheritance.
Inheritance supports the concept of hierarchical classification where the base class is known as parent class and the derived class is known as child class.
PolymorphismLike inheritance, polymorphism is another important concept of object oriented programming. The polymorphism is a Greek word which means the ability to take more than one form.In the case of programming, an operation may exhibit different behaviors in different instances.
The behavior depends on the types of data used in the operation.
Binding refers to the linking of a procedure call to the code to be executed in response to the call.
The dynamic binding which is also known as the binding or run-time binding means that the code associated with a given procedure call is not known until the time of the call at run-time.
The communication between two or more objects of classes is known as message passing. Objects communicate with one another by sending and receiving information much the same way as people pass messages to one another.