Qore Programming Language

  • Increase font size
  • Default font size
  • Decrease font size

How can a base class call a method in a derived class?

E-mail Print PDF
How can a base class call a method in a derived class?
As of Qore 0.8.1, just make the call normally; if the runtime class is different than the parse-time class (i.e. the class where the call is actually made from), then the actually method will be looked up dynamically at runtime.
If no method with this name is implemented in the base class, then you could get a "nonexistent-method-call" warning; if the call is valid, either use the cast<> operator to cast to a class where the method is implemented (and which matches an available class in the run-time object(s) used), or turn off the warning for that block (%disable-warning nonexistent-method-call).
Last Updated on Friday, 24 December 2010 11:36