OOPs concept in c++

oops-concept-in-c-plus-plus

OOps stand for object oriented programming.Object oriented programming is a way of solving complex problems by breaking them into smaller problems using objects. Before Object Oriented Programming (commonly referred as OOP), programs were written in procedural language, they were nothing but a long list of instructions. On the other hand, the OOP is all about creating objects that can interact with each other, this makes it easier to develop programs in OOP as we can understand the relationship between them.

What is procedural-oriented programming?

Procedural Oriented Programming is a programming language that follows a step-by-step approach to break down a task into a collection of variables and routines (or subroutines) through a sequence of instructions.

Object-Oriented Programming(OOP)

In Object-oriented programming, we write programs using classes and objects utilizing features of OOPs such as Object, class, abstractionencapsulationinheritance, and polymorphism.Now we will each and every features.

What is Object?

Any entity that has state and behavior is known as an object. For example: chair, pen, table, keyboard, bike etc. It can be physical and logical.

What is Class?

Collection of objects is called class. It is a logical entity.

What is Inheritance?

When one object acquires all the properties and behaviours of parent object i.e. known as inheritance. It provides code reusability. It is used to achieve runtime polymorphism.

What is polymorphism?

When one task is performed in different ways i.e. known as polymorphism. For example: to convince the customer differently, to draw something e.g. shape or rectangle, etc.

In C++, we use Function overloading and Function overriding to achieve polymorphism.

What is Abstraction ?

Hiding internal details and showing functionality is known as abstraction. For example: phone call, we don’t know the internal processing.

In C++, we use abstract class and interface to achieve abstraction.

What is Encapsulation?

Binding (or wrapping) code and data together into a single unit is known as encapsulation. For example: capsule, it is wrapped with different medicines.

Advantages of OOP

  1. We can build the programs from standard working modules that communicate with one another, rather than having to start writing the code from scratch which leads to saving of development time and higher productivity,
  2. OOP language allows breaking the program into bit-sized problems that can be solved easily (one object at a time).
  3. The new technology promises greater programmer productivity, a better quality of software, and lesser maintenance cost.
  4. OOP systems can be easily upgraded from small to large systems.
  5. It is possible that multiple instances of objects co-exist without any interference,
  6. It is very easy to partition the work in a project based on objects.
  7. It is possible to map the objects in the problem domain to those in the program.
  8. The principle of data hiding helps the programmer to build secure programs which cannot be invaded by the code in other parts of the program.
  9. By using inheritance, we can eliminate redundant code and extend the use of existing classes.
  10. Message passing techniques are used for communication between objects which makes the interface descriptions with external systems much simpler.
  11. The data-centered design approach enables us to capture more details of the model in an implementable form.

Disadvantages of oop

  1. oop takes longer to learn than traditional programming
  2. with oop classes tend to be overly generalized
  3. sometimes the relations among classes become artificial.
  4. the oop programs can be tricky at times.
  5. the oop requires proper planning and proper designing for coding.
0 0 vote
Article Rating

Do you want to hire us for your Project Work? Then Contact US.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x