   C++ class casting
  Hi everyone,I just started using angelscript and got quiet used to it. Now I have a question regarding class casting.Consider this:// C++class CInstance{ setTemplate(CTemplate* pTemplate);};class CTemplate{ void render();}class CSphere : public CTemplate{ void render();}I have registered all of these classes in the AngelScriptEngine, except the relation CSphere:CTemplate. Now if I try to do, in angelscript code, something like this:instance inst;sphere sp;inst.setTemplate(sp);I get the error that it cannot be casted ( in the setTemplate call ).Is there some sort of cast operator in Angelscript ?Thx in advance,Marcus   
  Not yet, but I'm getting closer to implement this.For now you can register a function that does an explicit cast:CTemplate *cast(CSphere *o){  return (CTemplate*)o;}engine->RegisterGlobalFunction("template &cast(sphere &)", asFUNCTION(cast), asCALL_CDECL);Or you can register an overloaded setTemplate() method that accept a sphere object. Regards,Andreas   ;  I've had many problems with declaring the c++ function with * and the scriptcall with &, so I recently switched to object handels, they seem to be far more stable / easy to use.I did now use a little hack to circumvent the casting, which is not as nice as your solution, by simply registering the same function with different scriptcall declarations, e.g. i registered "void setTemplate(sphere@)" and "void setTemplate(cube@)". in the c++ setTemplate I then dynamic_cast the Pointer to CTemplate. This works quiet well too, but for sure will be more work than declaring a cast for the classes once.Thx for your replay,Maddi   