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
I think of it as object is a container of some related logic, ie a repository to write/get stuff fr database, an http client or some entity that contains business logic. You can then encapsulate stuff in it and expose publicly only those things that should be accessed from outside. This makes it way easier to understand what an object does.
Polymorphism and inheritance are less used concepts, it adds complexity and should not be used lightly. Would not focus on those when learning.
Latest Answers