[SOLVED] - Inheritance issue

Started by
-1 comments, last by candemir 10 years, 10 months ago

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!

This topic is closed to new replies.

Advertisement