Slide 24
Slide 24 text
Garbage Collection
class Point
def initialize(x, y)
@x, @y = x, y
end
end
class Line
def initialize(p1, p2)
@p1, @p2 = p1, p2
end
def length
# compute length
end
end
def length(x1, y1, x2, y2)
p1 = Point.new(x1, y1)
p2 = Point.new(x2, y2)
line = Line.new(p1, p2)
line.length
end