How does Object Oriented Programming work? What does it do and how is it effective?

1.11K views

How does Object Oriented Programming work? What does it do and how is it effective?

In: Technology

10 Answers

Anonymous 0 Comments

The big bois of OOP are Abstraction, Encapsulation, Inheritance, and Polymorphism.

**Abstraction** basically means, when you tell this program that’s a calculator 2^(4) + 3 = ?, you don’t know how it figured out the answer, but you know it did.

**Encapsulation** is how each object has ‘ownership’ of the things inside of it. Basically objects can’t mess with data in other objects unless you explicitly allow for it.

**Inheritance** is just how it sounds, if you have a object inside and object, it can inherit the properties of the parent object. **Polymorphism** is altering the children despite what it can inherit.

For example, your house (parent) has two rooms (children) in it. The air conditioning is at 75 degrees. One room inherits the temperature of the house, 75 degrees. One room as a window unit (a method/function) that allows for it to either inherit the temp from the house (parent) or you can alter it with its own ac (Polymorphism).

Polymorphism is a bit more complicated than that, but for the sake of not having a long winded explanation, that’s basically it.

OOP is sometimes preferred because of its abstraction and encapsulation. It only shows precisely what it has to show, so its a bit more secure, and polymorphism lets you code in a lot of alternate courses of action for the program to take for certain parts of the program.

You are viewing 1 out of 10 answers, click here to view all answers.