Search code examples
c++coopprocedural-programming

What's the difference between a procedural program and an object oriented program?


I'm fairly new to programming but I've been reading some interesting discussions on StackOverflow about various programming approaches. I'm still not 100% clear on what the difference is between procedural programming and object oriented programming. It sounds like object oriented programming still uses procedures (methods) but everything is organized differently because the object is the star of the show. But it seems to me that procedures still allow you to do all of the same things. Like in C, you can put all of your similar procedures into a library. So couldn't you really say that a library in C is similar to an object in C++?


Solution

  • The difference between the two is subtle but significant.

    In a procedural program, modules interact by reading and writing state that is stored in shared data structures.

    In an object oriented program, modules in the form of objects interact by sending messages to other objects.