c++ - Error when casting a base pointer: `Cannot instantiate abstract class` -
i'm working physx in c++ , getting error,cannot instantiate abstract class
in following code:
std::vector < pxjoint* > joints; pxd6joint* j = pxd6jointcreate(*gphysics, a0, t0, a1, t1); joints.push_back (j); (pxd6joint)(joints[0])->setdriveposition(pxtransform()); //error here
the code example. pxd6joint abstract class inherits pxjoint. figure there must way access public members of &j
via joints[0]
, but, if there is, i'm not doing right.
as told joachim, trying cast result of setdriveposition pxd6joint type, wrong (especially since method nots return anything. guess trying somehow cast object pointed joints[0] pxd6joint type, useless, of correct class.
but class pure abstract class : methods not implemented (setdriveposition (const pxtransform &pose)=0). need use object of subclass of pxd6joint, methods implemented.
Comments
Post a Comment