Basic Principles Flashcards

1
Q

What are the 4 pillars of OOP

A

A PIE

1) Abstraction
2) Polymorphism
3) Inheritance
4) Encapsulation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Describe abstraction

A

= is an extension of Encapsulation
= you can hide the details of how data is stored and used within a class.

  • Only exposes the Properties and Methods
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe polymorphism

A

= allows objects of different classes to be treated as objects of a common superclass.

It enables methods to be invoked on objects without knowing their specific types, leading to more flexible and reusable code.

= uses inheritance and interfaces?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe Inheritance

A

= allows a class (subclass) to inherit attributes and methods from another class (superclass).

  • It promotes code reuse and facilitates the creation of hierarchies of related classes.
  • allows us to create more specific versions of an existing class
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe Encapsulation

A

= idea that you package everything an object is and can do into a class

= helps hide the internal implementation details of an object and provides access through well-defined interfaces.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the SOLID principles?

A

S = Single-responsibility
O = Open-closed
L = Liskov Substitution
I = Interface Segregation
D = Dependency Inversion

How well did you know this?
1
Not at all
2
3
4
5
Perfectly