Object Oriented Programming Flashcards
What are the 4 pillars of object oriented programming?
Encapsulation, Abstraction, Inheritance, and Polymorphism
In OOP
Variables are called?
Functions are called?
Property
Method
What is encapsulation?
Encapsulation is the packing of data and functions into one component (for example, a class) and then controlling access to that component to make a “blackbox” out of the object.
The process of wrapping code and data together into a single unit.
Information hiding
Example: wraps variables and functions into a class which can be made private, so the variables can’t be accessed unless they are made public or through a public method
What is Abstraction?
Displays only essential information and hides the details.
Implantation hiding
Its main goal is to handle complexity by hiding unnecessary details from the user. That enables the user to implement more complex logic on top of the provided abstraction without understanding or even thinking about all the hidden complexity.
What is Inheritance?
It used to inherit attributes and methods of a class.
Inheritance is a useful feature that allows code reusability.
The process where one class acquires the attributes and methods of another.
What is Polymorphism?
that provides a way to perform a single action in different forms. It provides an ability to call the same method on different JavaScript objects.
Polymorphism is the OOPs principle which provides the facility to perform one task in many ways.
Poly means many and morphism means many forms. Your classes can do the same thing in many ways.
What is an object in JavaScript?
It’s basically a collection of key value pairs
TRUE OR FALSE:
The first letter of a Constructor function should be capitalized
True
What is an example of abstraction?
A user knows that my pressing the brakes in a car stops the car but doesn’t know mechanics on how it makes that happen