Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
Define an Abstract Base Class in Python.
Refer to the `abc` documentation.
What happens if you instantiate an abstract class directly?
Think of trying to create a shape without knowing which specific shape it is.
What is an Abstract Base Class?
Think of a class outlining instructions.
True or False: Abstract methods must be implemented in subclasses.
Remember the nature of abstract methods.
Design an abstract class for a Vehicle that mandates methods start and stop. Implement this ABC for the sub-classes Car and Bicycle.
Consider how vehicles might behave differently when starting and stopping.
Create an abstract base class named Employee that includes an abstract method calculate_salary. Design subclasses for FullTimeEmployee and PartTimeEmployee.
Think about how salaries differ for full-time versus part-time positions.
5 more questions in this section. Enroll free to practise them all.
Enroll free