T
Thufir
I could have "instance" variables in Creature, which Dragon objects
can use? Dragon would have all the methods of the Creature module
available, for instance attribute accessors?
C:\code>
C:\code>
C:\code>type Creature.rb
module Creature
def sayHi
print "\nhi\n\n"
end
end
C:\code>
C:\code>type Dragon.rb
require 'Creature'
class Dragon
extend Creature
include Creature
def toString
print "\ndragon\n"
end
end
C:\code>
thanks,
Thufir
can use? Dragon would have all the methods of the Creature module
available, for instance attribute accessors?
C:\code>
C:\code>
C:\code>type Creature.rb
module Creature
def sayHi
print "\nhi\n\n"
end
end
C:\code>
C:\code>type Dragon.rb
require 'Creature'
class Dragon
extend Creature
include Creature
def toString
print "\ndragon\n"
end
end
C:\code>
thanks,
Thufir