class Demo:
pass
class ADemo(Demo):
def __init__(self, *args, **kwargs):
pass
class BDemo(Demo):
def __init__(self, *args, **kwargs):
pass
def get_demo(name, *args, **kwargs) -> Demo:
""" factory method """
if name == 'A':
return ADemo(*args, **kwargs)
elif name == 'B':
return BDemo(*args, **kwargs)
else:
raise ValueError(...)
class Factory:
def make_a(self) -> A:
pass
def make_b(self) -> B:
pass