OOP

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/9

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

10 Terms

1
New cards

What are the 4 principles of OOP?

  • Encapsulation

  • Abstraction

  • Inheritance

  • Polymorphism

2
New cards

What is Encapsulation?

Encapsulation is bundling data (properties) and methods that operate on that data into a single unit (class) and restricting direct access to some of the object’s components.

3
New cards

Why is Encapsulation important?

  • Protects data

  • Prevents unintended modification

  • Improves maintainability

  • Controls access using public/private/protected

4
New cards

What is Abstraction?

Abstraction is hiding complex implementation details and exposing only the essential features of an object.

5
New cards

How is Abstraction achieved?

  • Interfaces

  • Abstract classes

  • Public APIs

6
New cards

What is Inheritance?

Inheritance allows a class (child) to acquire properties and methods of another class (parent).

7
New cards

Why use Inheritance?

  • Code reuse

  • Logical hierarchy

  • Easier maintenance

  • Extending existing behavior

8
New cards

What is Polymorphism?

Polymorphism means “many forms” — the same method can behave differently depending on the object that calls it.

9
New cards

Types of Polymorphism

  • Method overriding (runtime)

  • Method overloading (compile-time, in some languages)

10
New cards

Real-world example of Polymorphism

A draw() method:

  • Circle → draws a circle

  • Square → draws a square