Chapter 8 Revision
Polymorphism is the key to writing extremely reusable code. Without it, you would have to write hundreds of duplicate functions!
Use these flashcards for active recall. Try to answer the question out loud before clicking the card to flip it.
Flashcards 🎴
Active Recall
Card
What is Polymorphism?
Click or Press Space to Flip
Key Takeaway
From the Greek for 'many forms', it is a programming language feature that allows a single interface, function, or data structure to be used for a general class of actions across many different data types.
Click to Flip Back
Active Recall
Card
What is a 'Generic Type'?
Click or Press Space to Flip
Key Takeaway
A generic type (like
List) uses a placeholder variable for the data type. It allows you to define the structure and behavior of a collection without hardcoding whether it holds Integers, Strings, or Booleans.Click to Flip Back
Final Chapter Quiz 🧠
CheckpointCheckpoint
Question 1 of 2Score: 0/2
If you write a function called 'getLength' that counts the items in a List, and that function works perfectly whether it is given a List of Integers OR a List of Strings, the function is demonstrating:
Ready to move on? You are now ready to tackle Type Inference in Chapter 9!