[Solved] How to get classes interact with one another


Let’s say you have person.rb:

Class Person
 .......
end

and you have dog.rb:

class Dog
 ........
end

If you want to access to Dog class inside Person you have to include it.
That means your dog.rb would be:

require 'dog'

class Person
  def my_method
    dog = Dog.new()
  end
end

require ‘name_of_file_with_class’

This is just a pure example how to make it accessible, furthermore it depends on what exactly do you want.

Cheers.

1

solved How to get classes interact with one another