Free Online Flashcard Deck

6 Interfaces and Abstractions Free Online FlashCards

Study 6 Interfaces and Abstractions with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.

12 cards
01
Front

What is an abstraction?

Back

An abstraction describes what an object can do while hiding the details of how it does it.

02
Front

What does an interface define?

Back

An interface defines a contract of required operations, properties, or members without normally specifying their implementation.

03
Front

What is an abstract class?

Back

An abstract class is an incomplete class intended for extension; it may combine abstract members, concrete methods, state, and protected operations.

04
Front

How do nominal and structural interfaces differ?

Back

Nominal typing requires explicit declaration that a class implements an interface; structural typing accepts a type when it has the required structure.

05
Front

Why implement multiple interfaces?

Back

A class can implement multiple interfaces, allowing it to support several independent capabilities.

06
Front

What is polymorphism in this context?

Back

Polymorphism lets one interface-typed variable or parameter refer to objects of different concrete types, each providing its own implementation.

07
Front

When is an interface preferable?

Back

Use an interface when a capability may apply to unrelated classes or when clients mainly need a small behavior-focused contract.

08
Front

When is an abstract class preferable?

Back

Use an abstract class when related subclasses should share state, construction rules, protected members, or substantial implementation.

09
Front

What is dependency injection?

Back

Dependency injection supplies a component’s required object from outside instead of having the component construct or locate it internally.

10
Front

What does dependency inversion change?

Back

Dependency inversion makes important application logic depend on abstractions while concrete infrastructure implements those abstractions.

11
Front

What does programming to abstractions mean?

Back

Programming to an abstraction means declaring types using the most general contract that provides everything the code actually needs.

12
Front

What else does an abstraction contract include?

Back

An abstraction’s contract includes semantics such as error behavior, invariants, copying or referencing rules, thread safety, and expiration—not only signatures.