Object interaction : Instance : Class PYTHON TUTORIALS


PYTHON TUTORIALS » Class » Instance »

 

Object interaction


class Player(object):
    def blast(self, enemy):
        print "player"
        enemy.die()


class Alien(object):
    def die(self):
        print "Alien"

hero = Player()
invader = Alien()
hero.blast(invader)



Leave a Comment / Note


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


PYTHON TUTORIALS

 Navioo Class
» Instance