N
none
Does anyone know why it would be impossible for me to subclass
GSL::Matrix? This might be evidence of my lack of sophistication in
Ruby or OO, but perhaps there is an easy or interesting answer. Here
is the code:
class SuperMatrix < GSL::Matrix
def initialize
@foo = 2
super
end
def whatever
return @foo
end
end
m = SuperMatrix.new([1,2,3], [4,5,6])
irb(main):058:0> m.inspect
GSL::Matrix
[ 1.000e+00 2.000e+00 3.000e+00
4.000e+00 5.000e+00 6.000e+00 ]
irb(main):056:0> m.whatever
NoMethodError: undefined method `whatever' for
#<GSL::Matrix:0xb6f75264>
from (irb):56
Thanks to all for a great language and community!
GSL::Matrix? This might be evidence of my lack of sophistication in
Ruby or OO, but perhaps there is an easy or interesting answer. Here
is the code:
class SuperMatrix < GSL::Matrix
def initialize
@foo = 2
super
end
def whatever
return @foo
end
end
m = SuperMatrix.new([1,2,3], [4,5,6])
irb(main):058:0> m.inspect
GSL::Matrix
[ 1.000e+00 2.000e+00 3.000e+00
4.000e+00 5.000e+00 6.000e+00 ]
irb(main):056:0> m.whatever
NoMethodError: undefined method `whatever' for
#<GSL::Matrix:0xb6f75264>
from (irb):56
Thanks to all for a great language and community!