Inheritance and Polymorphism Flashcards

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/18

flashcard set

Earn XP

Description and Tags

Flashcards covering key concepts related to inheritance, polymorphism, and related topics in object-oriented programming.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

19 Terms

1
New cards

What is a subclass?

A class that inherits properties and behaviors from another class (superclass).

2
New cards

What is another term for subclass?

Child or derived class.

3
New cards

What is a superclass?

A class from which other classes inherit (also known as parent or base class).

4
New cards

What is code inheritance?

The mechanism by which a subclass acquires the properties and methods of its superclass.

5
New cards

What is composition in programming?

A design technique where a class contains objects of other classes as instance variables.

6
New cards

Define Composite Type

A type or class composed of other types or Classes.

7
New cards

What is multiple inheritance?

A feature where a class can inherit from multiple superclasses.

8
New cards

What is the diamond problem, and why is it significant?

An ambiguity that arises when a class inherits from two classes that have a common ancestor; it creates issues in determining which version of a method to inherit.

9
New cards

What is delegation in object-oriented design?

A design pattern where an object handles a request by passing it to another object (delegate).

10
New cards

What is abstract class?

A class that cannot be instantiated and is designed to be a base class for other classes.

11
New cards

What does 'protected access' mean in the context of class members?

A member that is accessible within its own class, its subclasses, and other classes in the same package.

12
New cards

What is constructor chaining?

The process of calling one constructor from another constructor within the same class or from a superclass.

13
New cards

What is static polymorphism?

Polymorphism that is resolved at compile time (also known as compile-time polymorphism).

14
New cards

What is dynamic polymorphism?

Polymorphism that is resolved at runtime (also known as runtime polymorphism).

15
New cards

What is an upcast?

Converting a subclass reference to a superclass reference.

16
New cards

What is a downcast?

Converting a superclass reference to a subclass reference.

17
New cards

What is a ClassCastException?

An exception thrown when attempting an illegal downcast.

18
New cards

What is the purpose of the 'instanceof' operator?

An operator used to check if an object is an instance of a particular class or interface.

19
New cards

What are enumerated types?

A data type consisting of a set of named constants.