[ODE] Specific Collision Handling...

Tim Field nobbis at mcs.vuw.ac.nz
Fri Oct 10 04:50:25 MST 2003


On Thu, 2003-10-09 at 20:05, Roel van Dijk wrote:
> ... So here you will need to come up with a way to get the class of an 
> object at runtime. Java has an 'instanceof' keyword, but c++ has no 
> such thing ...

Not true.  Check out RTTI (part of the C++ standard).

In any case, this approach is very non-OO.  What you really want are 
multimethods, i.e. functions for which the dispatch depends on more than 
one virtual parameter (which neither C++ nor Java has direct support for).  
As an example, check out:

  http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1463.html

Note the classic multimethods example is overlap() which might give you 
a hint that it's useful for this problem.


t.



More information about the ODE mailing list