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
OOP is a programming paradigm that dictates the use of classes and Objects.
Classes are how you define something to be, for example a vehicle, it has wheels and is used to move from point A to point B.
Objects in this example are a kind of vehicles, a car and a scooter are different vehicles, but both can move You from point A to point B, so both are vehicles, that means they share some functionality but both have their unique traits.
In other words, the classes are templates from where you can create algorithms that share functions and variables. So instead of creating every single one from scratch, you define a class and create Objects of that class.
Latest Answers