OOPc using C++

With this blog I want to share my knowledge of OOPs and C++. I Hope this can quench your thirst for learning.Any suggestions and comments are welcome.

Procedure Oriented vs Object Oriented Programming

Programming, at a high level, is the process of solving a problem in an abstract fashion, then writing that solution out in code. Object Orientated Programming and Procedure Oriented Programming are basically two different paradigms for writing code; more fundamentally, they are two different ways of thinking about and modeling the problem's solution. In a nutshell, Object Oriented programming deals with the elemental basic parts or building blocks of the problem, whereas Procedural programming focuses on the steps required to produce the desired outcome.



Object Orientation [OO], in general, is a methodology for modeling the real world or at least the problem being solved, by decomposing the problem into smaller discrete pieces called "Objects". What makes an "object" unique is the formal and explicit combination these smaller pieces' behavior with its' data into a single entity. The object's behaviors are called methods in OO terminology, while its data is called the Object's state. "Objects" will make up every part of the solution, that is, every part of the program will be made from objects. Formally, there are technical attributes of that must be present for a program (or a programming Language) to be considered Object Oriented, such as inheritance, polymorphism, encapsulation, and protection; aspects of these terms are still under debate in many programming circles, so no, 100% certain, absolutely clear definition is possible. The core concept, though, is that an "Object" is binding together of data and behavior, and Object Oriented programming, is the use of Objects while solving the problem.



People regularly interact with real objects, such as a book, or a pencil in the real world, Object Oriented programming provides tools to deal with these objects, such as "a book," in the abstract world of writing software more logically and naturally. 

Procedural Programming, by contrast, is a methodology for modeling the real world or the problem being solved, by determining the steps and the order of those steps that must be followed in order to reach a desired outcome or specific program state. For example, consider the problem: "calculate the month end closing balance for an account." The process is take the starting balance, subtract all the debits and add all the credits for the period and then you arrive closing balance. The key point for procedural programming is identification and articulation of the process or steps that must be followed.


In addition to programming, programming languages can also be considered Object Oriented [OO] or Procedural. The language used for writing code does not determine if a program is Object Oriented or Procedural; Object Orientation and Procedural, is a way of solving the problem or a way of thinking about the problem, not the language used to write the code. It is possible to write Object Oriented Programs in C, a procedural language, and similarly, you can write a Procedural Program in Java, an OO language. Object Oriented Languages have the benefit of supporting key aspect of Object Orientation in the language itself, making it easier to implement Object Oriented programs, and providing the native language support object oriented aspects like polymorphism or inheritance.


Software tries to model the real world in some way: Object Oriented Programming, boils down to what object do I have and how do they relate to and interact with each other. Procedural programming, boils down to what steps do I need to take to get the program in a certain state.

Procedure Oriented Programming
1.Prime focus is on functions and procedures that operate on data
2.Large programs are divided into smaller program units called functions
3.Data and the functions that act upo it are treated as separate entities.
4.Data move freely around the systems from one function to another.
5.Program design follows “Top Down Approach”.
-------------------------------------------------------------------------------------------------
Object Oriented Programming
1.Here more emphasis is laid on the data that is being operated and not the functions or procedures
2.Programs are divided into what are called objects.
3.Both data and functions are treated together as an integral entity.
4.Data is hidden and cannot be accessed by external functions.
5.Program design follows “Bottom UP Approach”.