I have a superclass called EntryForm. All sub-classes of this class need
to implement a function called draw(). To ensure that it is done so, I
declared it in the superclass and raise an error when a call is made to
the superclass’s implementation of the fn instead of being implemented
in the sub-class.
However, when I tried to instantiate the sub-class StudentEntryForm(I
have not implemented draw() in Student… and expect NotImplementedError
to be raised.), I get the following error:
lib/Qt/qtruby4.rb:2401:in method_missing': undefined methodraise’ for
#StudentEntryForm:0x000000022c5cc0 (NoMethodError)
def draw()
raise NotImplementedError, ‘You must implement draw() in all of
EntryForm’s sub-classes’
end
I definitely can’t reproduce this. Is there any more relevant code you
can
produce, or even a self-contained example that shows this bug? I can
only
imagine this happening if you defined something called raise somewhere,
and
even then, it’s hard to work out how it would eventuate …
I’ve attached the code I’m using. The error doesn’t come up when I use
Kernel::raise instead of just raise…
I haven’t defined any function called raise anywhere else so I’m not
sure why the error keeps coming up…
Thank you for your time!
Arlen C. wrote in post #1089532:
Hi Meghana,
I definitely can’t reproduce this. Is there any more relevant code you
can
produce, or even a self-contained example that shows this bug? I can
only
imagine this happening if you defined something called raise somewhere,
and
even then, it’s hard to work out how it would eventuate …