Inheritance Flashcards

(20 cards)

1
Q

Inheritance

A

It is a mechanism that enables one class to inherit
behavior and attributes of another class

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

It is how applying a general category into specific objects.

A

Inheritance

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

It is a visual tool that provides overview of a class

A

Class diagram

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

This modeling language consists of various types of diagrams

A

Unified Modeling Language (UML)

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

This is used to create derived classes

A

Inheritance

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

Importance of Inheritance

A
  • Save time
  • Reduce errors
  • Reduce amount of new learning required to use new
    class
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

This is used as the basis of inheritance

A

Base class (a.k.a. Parent class, Superclass)

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

This is a class that derives/inherits from the base class

A

Derived class (a.k.a. Child class, Subclass)

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

Always “is a” case or example of more general base
class

A

Derived class

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

To achieve inheritance in Java, this keyword is used

A

extends

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

This means that the child can only inherit the parent, not the way around

A

Inheritance as a one-way proposition

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

This keyword is a checker if an object is derived from a class, a subclass, or an interface.

A

instanceof

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

This contains data and methods defined in
original superclass

A

Subclass

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

Fact about overriding superclasses

A

Sometimes superclass data fields and methods not
entirely appropriate for subclass objects

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

Using same method name to indicate different
implementations

A

Polymorphism

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

How to override the parent class using the child class

A

Create method in child class that has same name
and argument list as method in parent class

17
Q

Ability of one method name to work appropriately for
different subclass objects of same parent class

A

Subtype polymorphism

18
Q

How to instantiate an object that is member of subclass

A

Call at least two constructors: one in base class, one in derived class

19
Q

How to access superclass methods ?

A

Using the “super” keyword