Skip to content

Instantly share code, notes, and snippets.

@amitpatelx
Last active August 30, 2019 06:46
Show Gist options
  • Save amitpatelx/7d6194155efd5818b1f40b2ff2fda9dd to your computer and use it in GitHub Desktop.
Save amitpatelx/7d6194155efd5818b1f40b2ff2fda9dd to your computer and use it in GitHub Desktop.
Augment Behaviour by Chaining
class Point
def initialize(x, y)
@x = x
@y = y
end
end
class Point3D < Point
def initialize(x, y, z)
super(x, y) # calls `initialize` method superclass
@z = z
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment