How can I access the name variable in the game class, when I assign it in the Player Class? I am slightly confused about classes inheritance and scope. (Ruby)
class Game
attr_accessor :name
def display_name
puts "Name is #{@@name}"
end
end
class Player
attr_accessor :name
def get_name
puts "What is your name? "
@@name = gets.chomp
end
end
player = Player.new()
player.get_name
game = Game.new()
game.display_name()
Thanks
player.name.