Multiple Inheritance : Class Inheritance : Class PYTHON examples


PYTHON examples » Class » Class Inheritance »

 

Multiple Inheritance


 

class A :
    def __init__(self:
        self.a = 1

    def print_me(self:
        print "A: " + str(self.a)

class B :
    def __init__(self:
        self.b = 2

    def print_me(self:
       print "B: " + str(self.b)

class C :
    def __init__(self:
        self.c = 3

    def print_me(self:
        print "C: " + str(self.c)


class D(A,B,C:
    def __init__(self:
        A.__init__(self)
        B.__init__(self)
        C.__init__(self)
        self.d = 4

    def printme(self:
      A.print_me(self)
      B.print_me(self)
      C.print_me(self)
      print "D: "+str(self.d)

d = D()
d.print_me()

d = D()
d.print_me()

   
  



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo Class
» Class Inheritance