Relationships - Day 4 Flashcards

1
Q

3 ways to associate relationships between two classes

Reuse members of a class in another

A

Aggregation

Association

Inheritance

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

Association

A

Uses-a relationship

I.e Patient makes an appointment Vs A driver uses a car

Association is represented by an arrow in a class diagrams.

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

Aggregation

A

“Has a” type of relationship

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

Inheritance

A

“Is a” relationship.

Can have multiple sub classes.

When a class inherits from another class

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

Inheritance hierarchy

A

Parent class
^
|
Child class

Parents have multiple children

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

Inheritance of private, public etc.

A

Static and private cannot be inherited

No need for a parent type object with public inheritance

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

Inheritance uses what keyword

A

Extend

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

Super constructor

A

“super();” Has to be the first statement inside a constructor!

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

Types of inheritance

A

Single inheritance

Multilevel inheritance

Hierarchical inheritance

Multiple inheritance

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

Single inheritance

A

One class is extended by one class

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

Multilevel inheritance

A

A class extends another class which extended another class

Grandad - dad - son

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

Hierarchical inheritance

A

Multiple classes extend the same base class

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

Multiple inheritance

A

One class extends multiple classes.

Class 1 Class 2

(Don’t have to know this one as it’s not supported in Java)

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