A-level Computing/AQA/Paper 1/Fundamentals of programming/OOP Examples of key features

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Polymorphism[edit]

When you were young you might have watched the Mighty Morphin' Power Rangers. These guys could morph from regular people into their power suits. Sadly polymorphism isn't that exciting, but it does allow you to change the function of attributes and methods when you are inheriting from a parent class.

Inheritance[edit]

By using inheritance it makes creating new classes very quick and easy. It also allows for a modular approach to creating classes, where you might never use the base class at all, but only as a means of creating other child classes.

Rather than having to rewrite the same functionality for similar objects, OOP allows you to reuse attributes and methods from parent classes.

Overriding[edit]