Skip to content

Instantly share code, notes, and snippets.

@rosylilly
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rosylilly/bc990f289ddf0d74d5ae to your computer and use it in GitHub Desktop.
Save rosylilly/bc990f289ddf0d74d5ae to your computer and use it in GitHub Desktop.
puts "Hello, World"
STDOUT.puts "Hello, World"
class Point
property :x, :y
def initialize(@x, @y)
end
end
struct Point
property :x, :y
def initialize(@x, @y)
end
end
class RPoint
property :x, :y
def initialize(@x, @y)
end
end
struct VPoint
property :x, :y
def initialize(@x, @y)
end
end
def show(point)
puts "1: #{point.x}x#{point.y}"
point.x += 10
puts "2: #{point.x}x#{point.y}"
end
a = RPoint.new(10, 10)
b = VPoint.new(10, 10)
puts "Reference"
show(a)
show(a)
puts "Value"
show(b)
show(b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment