CLASS NOTES PART 2 Flashcards

1
Q

What are objects?

A

Instance of a class

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

What is a class?

A

Structure that contains data and methods

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

Four Basic OOP Principles

A

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

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

What is Encapsulation?

A

Protects the data inside of it

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

What is Inheritance?

A

One object can re-use the code of another object through an IS-A relationship vs a HAS-A relationship.
1.) Strong relationship
2.) Fragile base class – changes to the
parent can break the behavior of it’s
children.
3.) Class Explosion

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

What is Polymorphism?

A

Many shapes
Parameter overloading
add(int i1, i2){}
add(int i1, i2,int i3){}
Many objects with the same base class
can have different shapes
class Shape{ draw(){}}
class Circle extends Shape{ draw(){}}
class Square extends Shape{draw{}}

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

What is Abstraction?

A

Any method that does anything is providing functionality that I don’t need to know about.

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