0

I have one file named class1.rb this is structure

module Person
  class Amit
    def initialize
      @a=10
    end
  end 
end

another file named class2.rb

module Person 
  class Sumit < Amit
    def aos
      puts "#{@a}"
    end
  end
end

i am not able to acess variable @a in Sumit how do i do that??

Arkku
  • 41,011
  • 10
  • 62
  • 84
Amit Singh Tomar
  • 8,380
  • 27
  • 120
  • 199

1 Answers1

0

You may have a look here(adding-an-instance-variable-to-a-class-in-ruby).

Community
  • 1
  • 1
kfl62
  • 2,434
  • 4
  • 29
  • 40