diff --git a/DesignPattern/Decorator/duck_typing.py b/DesignPattern/Decorator/duck_typing.py index 857720b..eca56de 100644 --- a/DesignPattern/Decorator/duck_typing.py +++ b/DesignPattern/Decorator/duck_typing.py @@ -15,3 +15,13 @@ # 内部ライブラリ + +class Specialstring: + def __len__(self): + return 21 + + +# Driver's code +if __name__ == "__main__": + string = Specialstring() + print(len(string)) diff --git a/DesignPattern/Decorator/formatting_tool.py b/DesignPattern/Decorator/formatting_tool.py index a349d63..c1065bc 100644 --- a/DesignPattern/Decorator/formatting_tool.py +++ b/DesignPattern/Decorator/formatting_tool.py @@ -61,6 +61,7 @@ def render(self): if __name__ == '__main__': before_gfg = WrittenText("GeeksforGeeks") + after_gfg = ItalicWrapper(UnderlineWrapper(BoldWrapper(before_gfg))) print("before :", before_gfg.render())