Ch 8 Flashcards

1
Q

Inheritance

A

The property that instances of a child class (or subclass) can access both data and behavior (methods) associated with a parent class (or superclass).

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

Extension

A

Inheritance means that the behavior and data associated with child classes are always an extension (i.e. a larger set) of the properties associated with the parent classes. A subclass will have all the properties of the parent class and other properties as well.

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

Contraction

A

Since a child class is a more specialized (or restricted) form of the parent class, it is also, in a certain sense, a contraction of the parent type.

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

Reasons to use inheritance

A

There are two main reasons to use inheritance:

1) . Inheritance as a means of code reuse. Because a child class can inherit behavior from a parent class, the code does not need to be rewritten for the child.
2) . Inheritance as a means of concept reuse. This occurs when a child class overrides behavior defined in the parent. Although no code is shared between the parent and child, the child and parent share the definition of the method.

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

Subclassing for specialization

A

The child class is a special case of the parent class; in other words, the child class is a subtype of the parent class.

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

Subclass for specification

A

The parent class defines behavior that is implemented in the child class but not in the parent class.

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

Subclass for construction

A

The child class makes use of the behavior provided by the parent class but is not a subtype of the parent class.

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

Subclass for generalization

A

The child class modifies or overrides some of the methods of the parent class.

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

Subclass for extension

A

The child class adds new functionality to the parent class but does not change any inherited behavior.

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

Subclass for limitation

A

The child class restricts the use of some of the behavior inherited from the parent class.

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

Subclass for variance

A

The child class and parent class are variants of each other, and the class-subclass relationship is arbitrary.

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

Subclass for combination

A

The child class inherits features from more than one parent class. This is multiple inheritance.

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

Singleton

A

An object that there only ever will be one instance of within a program.

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

Benefits of inheritance

A

Software reusability, code sharing, consistency of interface, software components, rapid prototyping, polymorphism & frameworks, information hiding.

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

Costs of inheritance

A

Execution speed, program size, message-passing overhead, program complexity.

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