Feature | Object-Oriented Programming (OOP) | Procedural Programming |
Basic Unit | Object (Instance of a Class) | Procedure or Function |
Data and Functions | Bundled together in Objects (Encapsulation) | Separated – Data in Structures, Functions outside |
Program Structure | Organized around Objects and Classes | Organized around Procedures and Functions |
Data Abstraction | Emphasizes abstraction through Classes and Objects | Less emphasis on abstraction, data may be exposed |
Code Reusability | Promotes code reuse through Inheritance | Code reuse is achieved through functions and procedures |
Inheritance | Hierarchical structure, allows for class hierarchy | Typically not supported, or achieved through functions |
Polymorphism | Supports polymorphism, allows objects to be treated uniformly | Limited or no support for polymorphism |
Encapsulation | Enforces encapsulation, hides internal details | Limited encapsulation, data may be directly accessed |
Flexibility | Offers greater flexibility and adaptability | May be less flexible and modular |
Example Languages | Java, C++, Python, etc. | C, Pascal, Fortran, etc. |