/ Published in: Python
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
class Slave1(object): t1="1" class Slave2(object): t2="2" class MetaClass(type): def __new__(meta, classname, bases, classDict): bases = tuple([Slave1, Slave2]) return type.__new__(meta, classname, bases, classDict) class Master(object): __metaclass__ = MetaClass m=Master() print m.t1 print m.t2