GeorgeP Posted July 24, 2012 Share Posted July 24, 2012 Hello. I want to have an abstract method in a base class which will be implemented in derived classes. Are there abstract methods ? thnx Link to comment
ulf.schroeter Posted July 24, 2012 Share Posted July 24, 2012 Are there abstract methods ? No, but you can dump an error message or even throw an exception in the base UNIGINE script class to 'force' overriding in derived classes class InstanceBase { ...... int onStateRegistered( State state ) { log.error("InstanceBase::onStateRegistered() called, should be implemented by derived class !\n"); return 1; } void onStateDeregistered( State state ) { throw("InstanceBase::onStateDeregistered() called, should be implemented by derived class !\n"); } int onStateModified( State state ) { // base implementation return 1; } ..... }; Link to comment
Recommended Posts