If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

Hii, friends ..good morning.
What is use of Oops(Object Oriented Programming) in C++?

That is what C++ is all about. You use it to do object oriented programming.

If you just wanted to write procedural programs then you would use C rather than C++ because C++ is C with the additions needed to be able to write OOP.

The advantages to writing OOP with C++ are the same as writing OOP in any other programming language - it makes it easier to break big programs up into manageable sections and to reuse code in multiple programs - by defining objects that not only contain all of the data associated with a particular object but also all the code to handle all the different things you can do with that object.

Users who have thanked bparker1084 for this post:

That is what C++ is all about. You use it to do object oriented programming.

It is impossible for a programming language to be purely object oriented, because object orientation is an abstract of the data structures. Data structures aren't the only language features of a programming language required to express algorithms. Consider while and for loops, which are procedural elements. C++ also has lambdas, which are functional elements.

Originally Posted by felgall

If you just wanted to write procedural programs then you would use C rather than C++ because C++ is C with the additions needed to be able to write OOP.

C++ is not an extension of C. That may have been true in 1985, but since then there have been numerous features added to both programming languages that haven't been synchronised, some of which clash. For example, C uses a less static type safety than C++. The modulo operator isn't required to behave identically when handling a negative denominator. In C++, sizeof 'a' is 1 where in C, sizeof 'a' is sizeof (int). C has the addition of variable length arrays and flexible array members which C++ doesn't have. The list goes on...

Originally Posted by felgall

The advantages to writing OOP with C++ are the same as writing OOP in any other programming language - it makes it easier to break big programs up into manageable sections and to reuse code in multiple programs - by defining objects that not only contain all of the data associated with a particular object but also all the code to handle all the different things you can do with that object.

Have you ever studied the Liskov Substitution Principle? I would suggest that proper OOP is quite a restrictive form of abstaction.

As for an answer to this question, I'll quote a user from another forum. Rest assure I have permission to do so.

Originally Posted by Seb

Object orientation is an abstraction. Consider the definition of car, which is a category that consists of all things with four wheels, gears, an engine and a steering wheel, among other things. This is an abstract definition of a car.

The "car" might define a method called "stear" or "turn", which is an action if you like, that an instance of a car can perform to change it's own direction or bearing. According to Liskov substitution principle, it would be incorrect to define a "drive" method in "car" because manuals drive differently to automatics.

By inheritance, derivations such as "automatic car" and "manual car" can be defined to re-use and extend the properties of the "car". The two extensions can then implement their own "drive" or "accelerate" methods, etc. Other projects can then reuse these implementations. That's the idea behind abstraction.

One of the only things that the community of OOP programmers can agree upon is that any code that uses "car" correctly should be able to use "automatic car" and "manual car" in it's place without any problems or differences in functionality. ...

The rest of the post assumes lack of specifics regarding the language. I won't provide further specifics regarding C++, because this is a pretty good answer to your question. If you have more questions, feel free to ask them.

Hi..
The oop is to create an object,It's a properties and methods.while designing c++ modules, we try to see the whole world in the form objects. For example Bus is an object which has certain properrites such as color, numbero of doors.etc., it also has certain methods such as accelerate,breke,and so on..

OOPS is now used into all the programming language. It really understandable language to program or develop a software. When I was a beginner stage of learning the programming, then I love to prefer mostly the OOPS with using C++ into the Turbo C++ IDE.

C++ is called oops because the variable. We create are called objects, and the program is fully depend on the object. A Compiler is that which is used to compile the program and transfers the user defined language to computer language.

Object oriented programming is method of programming where a system is considered as a collection of objects that interact together to accomplish certain tasks. Objects are entities that encapsulate data and procedures that operate on the data.