You are on page 1of 1

1. What is OOP?

- not a specific language but a concept that is widely used


- almost all of the modern languages we have today follows the principle of OOP
- style associated with the concept of class and objects for example
- solves the dillemma of having a more convenient code by creating objects that
will interact with each other
- allows us to write a none or minimal code duplication
- solves the dillemma of having a more convenient code by creating objects that
will interact with each other

2. What is a Class vs. Object?


- these objects describe what a thing is and what it can do. For example: a
Subscribe button.
- This is done by writing a class. A class is a template or blueprint where you'll
define its methods and attributes. They are similar to structs in C wherein
creating a structure doesn't allocate any memory yet
- the class is only declared once and it doesn't allocate any memory when it is
created unlilke objects.
- The object is an instance of a class and it allocates memory when it is created.
It is the physical representation of data

3. What are the 4 pillars of OOP?


- encapsulation, abstraction, inheritance, polymorphism

abstraction
- hides the implementation details. It can be a prototype or a function. One can
just call the function without knowing what are behind the scenes.

encapsulation
- people refer to this as data hiding as it encapsulates or hides things making it
private. this limits what the people can access on your code which is a great
security measurement

inheritance
- by the word itself 'inherit', it lets an object acquire the properties and
methods of a parent object. This is to avoid redundancy.

polymorphism
- the ability of objects of various classes to be treated as objects of a common
superclass, which promotes reuse of code

You might also like