July 15, 2021

What is object oriented programming?

It seems, that object oriented programming has so many advantages and it is used so frequently that it has become hard to explain what the idea is. Especially non programmers find it difficult to get the advantages of the C++ language over existing paradigm which is structured programming.
In a single sentence, object oriented programming allows to use of global variables.
A global variable is a memory adress used by more than a single function. The same variable can be accessed from different subroutines of the program without sending the variable as a parameter to the function. A typical example consists of one or two struct variables which are accessed by three upto four different methods. The combination of the variables and the methods is creating a program within the program called class.
So the logical next question is, what should somebody need a global variable? In the classical structured programming technique global variables are not recommended. They are perceived as a wrong idea. The more likely paradigm is to provide the variable as a parameter to the function header. So the function can only manipulate objects they were provided in the heading.