Sign in to follow this  
Zaran

Polymorphism : dynamic method resolution

Recommended Posts

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 ?

Share this post


Link to post
Share on other sites
Indeed it woks. It was another error in my code which made me think it wasn't possible. I should have tested my code mmore carefully.

Thx a lot.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this