dred Posted November 18, 2015 Share Posted November 18, 2015 In an example I have 3 classes set up like this class Parent { virtual void MainFunction() { log.message( "Parents MainFnction\n" ); } virtual void NextFunction() { log.message( "Parents NextFnction\n" ); } }; class Child : Parent { virtual void MainFunction() { log.message( "Child MainFunction\n" ); NextFunction(); } }; class GrandChild : Child { virtual void NextFunction() { log.message( "GrandChild NextFnction\n" ); } }; If I create a GrandChild object and call MainFunction GrandChild gc = new GrandChild(); gc.NextFunction(); I would Expect the Child's version of MainFunction to get called which in turn should call the GrandChilds Version of NextFunction, but instead in Unigine Script The output is... Child MainFunction Parent NextFunction For some reason the child-most class isn't getting called. If I do the same thing in C++ I get what I expect to happen the Child MainFunction calls the NextFunction in the GrandChild Class. Link to comment
maxi Posted November 19, 2015 Share Posted November 19, 2015 Hi Dusty, That is known issue. Unfortunately, the inheritance concept in unigine script is not perfect and you have to override MainFunction in GrandChild as well. Link to comment
dred Posted November 19, 2015 Author Share Posted November 19, 2015 So they only safe way is to have empty versions of every virtual function in every derived class? That seams extremely fragile. Link to comment
Recommended Posts