Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Super Fast Intro To Object Oriented Programming

Super Fast Intro To Object Oriented Programming

Lightning talk given to introduce new programmers to the concept of OOP. I used pictures of baby animals to help break up the code.

Jennifer Konikowski

June 11, 2014
Tweet

More Decks by Jennifer Konikowski

Other Decks in Technology

Transcript

  1. class Animal(object): def __init__(self, name, species): self.name = name self.species

    = species def getName(self): return self.name def getSpecies(self): return self.species def __str__(self): return "%s is a %s" % (self.name, self.species)
  2. class Dog(Animal): def __init__(self, name, chases_cats, drools): Animal.__init__(self, name, "Dog")

    self.chases_cats = chases_cats self.drools = drools def chasesCats(self): return self.chases_cats def doesDrool(self): return self.drools
  3. class Cat(Animal): def __init__(self, name, scared_of_dogs, fat, goes_outside): Animal.__init__(self, name,

    "Cat") self.scared_of_dogs = scared_of_dogs self.fat = fat self.goes_outside = goes_outside def scaredOfDogs(self): return self.scared_of_dogs def isFat(self): return self.fat def goesOutside(self): return self.goes_outside