python how to merge classes

Solutions on MaxInterview for python how to merge classes by the best coders in the world

showing results for - "python how to merge classes"
Lila
08 Jul 2019
1class Foo(object):
2    def __init__(self, foonum):
3        super(Foo, self).__init__()
4        self.foonum = foonum
5
6
7class Bar(object):
8    def __init__(self, barnum):
9        super(Bar, self).__init__()
10        self.barnum = barnum
11
12class DiamondProblem(Foo, Bar):
13    # Arg order don't matter, since we call the `__init__`'s ourself.
14    def __init__(self, barnum, mynum, foonum):
15        Foo.__init__(self, foonum)
16        Bar.__init__(self, barnum)
17
18        self.mynum = mynum
19