Selective Inheritance Python
- by user1682595
I am making a python program which is using classes, I want one class to only selectively inherit from another e.g:
class X(object):
def __init__(self):
self.hello = 'hello'
class Y(object):
def __init__(self):
self.moo = 'moo'
class Z():
def __init__(self, mode):
if mode == 'Y':
# Class will now Inherit from Y
elif mode == 'X':
# Class will now Inherit for X
How can I do this without making another class?