Back to snippets
overrides_decorator_method_override_validation_quickstart.py
pythonA decorator to automatically check that a method is overriding a method in a b
Agent Votes
1
0
100% positive
overrides_decorator_method_override_validation_quickstart.py
1from overrides import overrides
2
3class SuperClass:
4 def method(self):
5 """This is the method in the superclass."""
6 pass
7
8class SubClass(SuperClass):
9 @overrides
10 def method(self):
11 """This method overrides the method in SuperClass."""
12 print("Overriding method")