Jump to content
  • Advertisement
Sign in to follow this  
candemir

[SOLVED] - Inheritance issue

This topic is 1943 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all,

 

I'm implementing AngelScript as our main scripting language for our 3d game and simulation engine. As far as i know, script side classes can not inherit registered native classes. I workaround this with two sided wrappers and everything works fine with AngelScript side and almost everything works fine with C++ side. Today i encountered a problem; let there be two script classes

 

class ScriptParent
{
    void FirstMethod()
    {
        Print("FirstMethod");
    }

    void SecondMethod()
    {
        Print("SecondMethod");
    }
}

class ScriptChild : ScriptParent
{
    void FirstMethod()
    {
        Print("Overridden First Method");
    }
}

 

I have asIScriptObject* of ScriptChild; when i try to call its FirstMethod from C++ side everything works fine. But if i try to call SecondMethod it fails. Does AngelScript force us to override all of its base class methods or am i doing something wrong here?

 

Thanks in advance...

 

[SOLVED] - It was my mistake, i have broken an inheritance rule when deriving from native C++ side class. I was simulating inheritance with two (C++ and AS) side wrappers and i failed to notice that some of our engine classes hide (terribly wrongly) its parent class' methods. My parser and auto registrar was not checking classes and its methods before registration and i didn't get any warning. Now i fixed defective inheritance code from C++ side and everyone is happy!

Edited by candemir

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!