I think most of the programmers come from C platform and many others come from other procedural or structural language platforms. After mastering C or any other structural languages, most of us might have thought about the following two major flaws of procedural programming:
-In procedural languages like C we are exposing our piece of code to externals (main() since it is also a user defined function) without setting any permissions. So, there is lack of security (code access security) to the code that we write for procedural languages like C. For example, if we are defining a function in C, there is no restriction to call that function at any point of time under main().
-In procedural languages like C we can define 'n' number of functions under a given program (say one.C). Now suppose that we are developing another program that should contain similar functions which are defined under one.C and the new program name is two.C. Though the functions defined in one.C are similar to the functions that are to be defined under two.C, we cannot consume these functions of one.C in two.C. So, there is no scope for reusability.
Due to the lack of these two major features code access security and reusability in procedural languages, Object-Oriented Programming (OOP) came into picture.
The problem of code access security is rectified by the concept of ENCAPSULATION in OOP and the problem of reusability is rectified by the concept of INHERITANCE in OOP. The other two major features apart from encapsulation and inheritance are Abstraction and Polymorphism which add some weight to the OOP.