Free Online Flashcard Deck

5 Polymorphism Free Online FlashCards

Study 5 Polymorphism with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.

12 cards
01
Front

What is polymorphism?

Back

Polymorphism lets one operation or abstraction work with values of different concrete types through a common type.

02
Front

What do declared and run-time types control?

Back

The declared type determines which operations are available, while the run-time type determines which override executes.

03
Front

Define dynamic dispatch.

Back

Dynamic dispatch is the run-time selection of an overridden method, using the object's actual run-time type.

04
Front

How does overriding differ from overloading?

Back

Overloading chooses among different parameter lists mainly from compile-time information; overriding selects an implementation of an existing virtual operation at run time.

05
Front

What enables a derived member to use dynamic dispatch?

Back

A derived class must override a virtual or abstract member to participate in dynamic dispatch.

06
Front

What behavior does C# `new` member hiding create?

Back

With `new`, the selected method can depend on the variable's declared type; with `override`, a base-class reference still reaches the derived implementation.

07
Front

What is interface-based polymorphism?

Back

An interface relationship means a class promises to provide the operations specified by an interface, without requiring shared implementation.

08
Front

What is duck typing?

Back

Duck typing accepts an object based on the operations it supports rather than requiring explicit inheritance from a named type.

09
Front

Define substitutability.

Back

Substitutability means a more specific object can replace a more general one without breaking client expectations.

10
Front

What does the Liskov Substitution Principle require?

Back

The Liskov Substitution Principle requires a subtype to preserve its supertype's behavioral contract, including relevant preconditions, postconditions, and invariants.

11
Front

What does programming against abstractions mean?

Back

Programming against abstractions makes clients depend on stable capabilities instead of concrete implementations.

12
Front

Why depend on abstractions?

Back

Depending on abstractions improves changeability, testability, extensibility, and separation of concerns.