Difference Between Procedural and Object-Oriented Programming
Many of us have learned to program in C, which is procedural programming. To appreciate the power of C++, which is an object-oriented programming paradigm, let us see the difference between procedural and object-oriented programming. We have also discussed the difference between C and C++ here.
Key Difference Between Procedural and Object-Oriented Programming
Procedural Programming | Object-Oriented Programming |
It does not support virtual functions. | It supports virtual functions. |
It does not support operator overloading. | It supports operator overloading. |
Supports the top-down approach. | Supports the bottom-up approach. |
Do not support namespaces. | Supports namespaces. |
Do not support polymorphism. | Supports polymorphism. |
Do not support inheritance. | Supports inheritance. |
Cannot have multiple declarations for global variables. | Cannot have multiple declarations for global variables. |
Allows main to be called through other functions. | Do not allow main to be called through other functions. |
What is Procedural Programming?
Procedural programming is derived from structural programming, which is alternately called modular programming. It follows a top-down approach in which the overall program is broken into modules. This allows the efficient loading of code and reusability in other programs. Modules are coded and tested separately, and once testing is done then, the modules are integrated into a single program structure.
Procedural programming is therefore based on modularization, which groups related code into a single module. Almost every modern programming language similar to C, Fortran supports the concept of modular programming. The program flow in structured programming follows a simple sequence and avoids the use of Go To statements.
Download Formulas for GATE Computer Science Engineering - Digital Logic
What is an Object-Oriented Programming?
The object-oriented programming paradigm allows to development of maintainable programs. It restricts the code from freely flowing around the system. The basic difference between procedural and object-oriented programming is that the procedural programs are task-based as they focus on the actions the software must accomplish. However, object-oriented programming is task-based as well as data-based.
In object-oriented programming (OOP), the list and the associated operations are considered as an entity called an object. The striking difference between procedural and object-oriented programming is that the source codes accessing the list need not contain the procedures for performing tasks in the object. Therefore we conclude that the OOP is data-based as well as task-based.
Download Formulas for GATE Computer Science Engineering - Computer Organization & Architecture
Comments
write a comment