From 8b760f197cb1c469b5e7aa3a920d3701a25ab34b Mon Sep 17 00:00:00 2001 From: "xuanyi.wang" Date: Thu, 13 Apr 2023 00:44:06 +0200 Subject: [PATCH] Update page 'Day 7 homework - Sloejtes' --- Day 7 homework - Sloejtes.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Day 7 homework - Sloejtes.md b/Day 7 homework - Sloejtes.md index 8739533..3a56b6a 100644 --- a/Day 7 homework - Sloejtes.md +++ b/Day 7 homework - Sloejtes.md @@ -181,3 +181,17 @@ None ``` **6. What happens when you try to call an abstract method, or access an abstract property in the base class?** +##### Answer: When trying to call an abstract method or access an abstract property in the base class, we will get a TypeError with a message indicating that the abstract method or property was not implemented in the subclass because abstract methods and properties in Python are meant to be overridden and implemented in subclasses. They serve as a sort of blueprint for what methods and properties a subclass should have, without dictating the implementation details. + +**Example:** +``` +v = Vehicle() +``` +###### Output: +``` +TypeError Traceback (most recent call last) +Input In [50], in () +----> 1 v = Vehicle() + +TypeError: Can't instantiate abstract class Vehicle with abstract methods num_wheels, start +``` \ No newline at end of file