diff --git a/1_introducao/15_interface_item.py b/1_introducao/15_interface_item.py new file mode 100644 index 0000000..4fc8574 --- /dev/null +++ b/1_introducao/15_interface_item.py @@ -0,0 +1,18 @@ +""" +Python não oferece a implementação explícita de interfaces, como Java, mas o +mesmo comportamento pode ser replicado de duas formas principais. +""" + + +from abc import ABC, abstractmethod + + +class Item1(object): + def __gt__(self, outro_item): + raise NotImplementedError() + + +class Item2(ABC): + @abstractmethod + def create_purchase_invoice(self, purchase): + pass