Last active
August 30, 2019 06:46
-
-
Save amitpatelx/7d6194155efd5818b1f40b2ff2fda9dd to your computer and use it in GitHub Desktop.
Augment Behaviour by Chaining
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
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