The following class hierarchy, where class "A" has an abstract method called "foo":
# -*- coding: utf-8 -*-
import abc
class A:
__metaclass__ = abc.ABCMeta
def __init__(self):
pass
@abc.abstractmethod
def foo(self):
return
class B(A):
def __init__(self):
super(B, self).__init__()
pass
def foo(self):
print 'Foo method in class B'
class C(B):
def bar(self):
print 'Bar method in class C'
def main():
class_c = C()
class_c.foo()
class_c.bar()
if __name__ == "__main__":
main()
This code works perfectly by printing the following:
"Foo method in class B"
"Bar method in class C"
My question is that Pycharm says that class "C" should implement all abstract methods, in this case the methods defined in class "A".
Is there a convention that says I have to implement all abstract methods? Is there a problem in not implementing?