Chapter 5 Flashcards

1
Q

What is multiple inheritance

A

A class inherited by more than one class

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

What is diamond problem

A

In multiple inheritance, if intermediate classes inheriting from same base class then the 3rd level of child class will have same behavior from two classes. It is called diamond problem.C++ gives solution to it that inheritance should be from only any one root.

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

What is association in OO

A

object interaction with each other is called association

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

What are 2 main types of associations

A
  • Class association (inheritance)
  • Object association (simple association, composition, aggregation)
    Note: object must have reference of one another.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is simple association

A

It is the weakest link between objects. It is the reference by which one object can interact with some other object.

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

What are sub types of simple association

A

w. r.t. navigation
- One-way association (single direction)
- Two-way association (both direction)
w. r.t. number of objects
- Binary association (2 objects interact)
- Ternary association (3 objects interact)
- N-ary association (more than 3 objects interact)

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

What is composition

A

An object may be composed of other smaller objects. It is called composition. Smaller objects are part of main object and it is strong relationship. A smaller object can not sustain independently. The relationship between objects is whole-part.

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

What is aggregation

A

An object may contain a collection of other objects. The relationship between the contained objects and container object is called aggregation. It is a weak relationship because aggregate object is not part of container and it can exist independently.

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