Skip to content

Instantly share code, notes, and snippets.

@mykiy
Created April 3, 2018 05:37
Show Gist options
  • Save mykiy/9a85e5fea454fee09fd3388b9a3d269d to your computer and use it in GitHub Desktop.
Save mykiy/9a85e5fea454fee09fd3388b9a3d269d to your computer and use it in GitHub Desktop.
class Work
def initialize(name)
@name = name
end
def name
@name
end
def name=(name)
@name = name
end
def greet(other)
p "hi #{other.name}, i am #{@name}"
end
end
person = Work.new("velu")
friend = Work.new("prasanth")
person.greet(friend)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment