Guest User

http://pt.stackoverflow.com/questions/72685/existe-interface

a guest
Jul 4th, 2015
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. >>> import abc
  2. >>> class Shape(object):
  3. ...     __metaclass__ = abc.ABCMeta
  4. ...     @abc.abstractmethod
  5. ...     def method_to_implement(self, input):
  6. ...         return
  7. ...
  8. >>> class Foo(Shape):
  9. ...     pass
  10. ...
  11. >>> foo = Foo()
  12. Traceback (most recent call last):
  13.   File "<stdin>", line 1, in <module>
  14. TypeError: Can't instantiate abstract class Foo with abstract methods method_to_implement
Add Comment
Please, Sign In to add comment