Hi,
I would like to do something like this :
class A
{
void method(){ something };
}
class B : A
{
void method(){ something else };
}
B objectB;
A@ copy = @objectB;
copy.method();
I would like the last line to call the method as it is defined in class B. In C++ this can be done by using virtual function. Can this be done in AngelScript, if not, is there some workaround ?
Polymorphism : dynamic method resolution
This works in AngelScript as well. All script class methods in AngelScript are automatically virtual. Nothing special needs to be done to do what you want.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement