I can’t really wrap my head around OOP. Like I understand an array and a function and a variable, but I don’t understand what an object is. Why can’t we just use functions and variables everytime we need information or code to run? I code in Python and JS mainly, so objects are truly the most important thing, but I don’t really get it. Also, isn’t every program object orientated? Even C, does it not fit the definitions? If so, how is it any different from C++?
In: Technology
[https://en.wikipedia.org/wiki/Smalltalk](https://en.wikipedia.org/wiki/Smalltalk)
That’s the best language to use for learning object oriented programming, because it’s a simple and pure OO language.
The reason for OO programming is to make programming easier, safer, faster and more reliable.
They use 4 principles to make things easier, and you’ll have to do some reading to understand them completely, but here’s a basic definition:
Encapsulation hide the implementation details of objects from the outside world (like variable names)
Inheritance allow subclasses to use code from superclasses)
Polymorphism allowing objects of different classes to perform actions with the same name using different code
Abstraction each object only reveals a specific mechanism for usage. Therefore, the code inside becomes largely independent of other objects
[https://career.softserveinc.com/en-us/stories/what-is-object-oriented-programming-oop-explaining-four-major-principles](https://career.softserveinc.com/en-us/stories/what-is-object-oriented-programming-oop-explaining-four-major-principles)
Latest Answers