swig/Examples/test-suite/java/dynamic_cast_runme.java
Dave Beazley 12a43edc2d The great merge
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4141 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2002-11-30 22:01:28 +00:00

29 lines
703 B
Java

import dynamic_cast.*;
public class dynamic_cast_runme {
static {
try {
System.loadLibrary("dynamic_cast");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
Foo f = new Foo();
Bar b = new Bar();
Foo x = f.blah();
Foo y = b.blah();
// Note it is possible to downcast y with a Java cast.
String a = dynamic_cast.do_test((Bar)y);
if (!a.equals("Bar::test")) {
System.err.println("Failed!");
System.exit(1);
}
}
}