Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Point # A point in n-space
- def initialize(*coords) # Accept an arbitrary # of coordinates
- @coords = coords # Store the coordinates in an array
- end
- def initialize_copy(orig) # If someone copies this Point object
- #isn't the following code wrong?
- @coords = @coords.dup # Make a copy of the coordinates array, too
- end
- end
Add Comment
Please, Sign In to add comment