Tobias Peters wrote:

> Any chance that SWIG could perform a cast to the most derived type 
> automatically?

It's not completely automatic, but there is feature that handles part of 
this. If you look at the CHANGES file in the top-level directory of the 
SWIG source code distribution you'll see an entry dated 3/18/2002 that 
talks about a mechanism for writing typemaps to downcast from base class 
pointers to a more-derived type.