def what_is_that puts $myvar end end class NewYork def what_is_that puts $myvar end end Output: chennai = Chennai.new newyork = NewYork.new chennai.what_is_that newyork.what_is_that -------------------------------------- Its is a Place Its is a Place
def show_me puts @current_place end end Output: chennai =Place.new(“Chennai”) newyork = Place.new(“New York”) chennai.show_me newyork.show_me -------------------------------------- Chennai New York
newyork.show_me -------------------------------------- Chennai New York Local Variable class Place def initialize(place) @current_place = place end def show_me puts @current_place end end