Support Forums
Example of Object Oriented Programming - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Python Programming Language (https://www.supportforums.net/forumdisplay.php?fid=32)
+---- Thread: Example of Object Oriented Programming (/showthread.php?tid=2914)



Example of Object Oriented Programming - nevets04 - 11-15-2009

Code:
class dog:
    def dog_set_name(self, name):
        self.name = name
    def dog_eat(self, eat):
        self.eat = eat

dog = dog()
dog.dog_set_name("Max")
dog.dog_eat("Dog Food")
# Now you can apply what you have just done.
a = dog.name,'eats',dog.eat
print " ".join(a)



RE: Example of Object Oriented Programming - Fallen - 11-16-2009

Dont forget to mention __init__ ;)