Polymorphism (OOP) (OCR A-Level Computer Science): Flashcards

📚Flashcards
Polymorphism (OOP)
Sign up to keep revising.Create a free account to study more flashcards and track your progress.

Practise the cards

13 cards from this deck

Show

Meaning of 'polymorphism'

'Many forms'

Type of polymorphism at runtime

Method overriding

Method overriding definition

Child class provides specific implementation of method already defined in parent

Type of polymorphism at compile-time

Method overloading

Method overloading allows

Multiple methods w/ same name but different parameters

Python's support for true method overloading

Not directly supported

Purpose of interfaces in polymorphism

Ensure different classes provide same methods

Polymorphism benefit: flexibility

Code works w/ different types interchangeably, adaptable

Polymorphism benefit: code reusability

Classes share methods, reducing redundancy

Polymorphism benefit: maintenance

More modular, less complex, improves maintainability

Polymorphism benefit: extensibility

New subclasses can extend/override methods easily

Requirement for overriding method signatures

Method name and parameters must match parent exactly

Risk of not using polymorphic methods

Duplicated code

Join 100,000+ A-Level students studying Flashcards with us.

Select your subjects, and get access to A+ resources today.