Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Example of Object Oriented Programming
#1
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)
Reply
#2
Dont forget to mention __init__ ;)
[Image: nv70ad.png]
Terrorcore, unleash, extermination
Hyper real, cold blood, determination
fudge them, I like this sensation
Incredible, I from the annihilation
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  TypeError: attribute of type 'NoneType' is not callable object chris0147 0 964 09-05-2014, 07:42 PM
Last Post: chris0147
  Programming help nagarjungupta 2 1,019 08-02-2013, 12:28 AM
Last Post: nagarjungupta
  python programming for hamiltonian cycle joseph george 0 806 02-23-2013, 09:18 AM
Last Post: joseph george
  'X' object has no attribute 'y' band_master 1 1,094 04-23-2012, 09:54 PM
Last Post: band_master
  [Guide] Object Serialization in Python manipulate 3 1,439 08-12-2011, 10:39 AM
Last Post: BreShiE

Forum Jump:


Users browsing this thread: 1 Guest(s)