Guest User

Untitled

a guest
Jan 15th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.37 KB | None | 0 0
  1. class Point                 # A point in n-space
  2.   def initialize(*coords)   # Accept an arbitrary # of coordinates
  3.     @coords = coords        # Store the coordinates in an array
  4.   end
  5.  
  6.   def initialize_copy(orig) # If someone copies this Point object
  7.  #isn't the following code wrong?  
  8.  @coords = @coords.dup   # Make a copy of the coordinates array, too
  9.   end
  10. end
Add Comment
Please, Sign In to add comment