Created
January 10, 2010 04:25
-
-
Save kfitzpatrick/273332 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Example 1: | |
function add(oneNumber, anotherNumber){ | |
return (oneNumber + anotherNumber); | |
} | |
add(3,4); | |
----------- | |
Example 2: | |
class WheelSet | |
def turn! | |
# do some stuff | |
end | |
end | |
class Vehicle | |
def initialize | |
@wheels = WheelSet.new | |
end | |
end | |
class Car < Vehicle | |
def drive! | |
@wheels.turn! | |
end | |
def go | |
drive! | |
end | |
end | |
my_car = Car.new | |
my_car.go |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment