Jump to content

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now
- - - - -

[SOLVED] - Inheritance issue

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
No replies to this topic

#1 Candemir   Members   

150
Like
0Likes
Like

Posted 30 May 2013 - 08:50 AM

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, 04 June 2013 - 04:47 AM.





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.