swarm-modeling
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: polymorphism (was compare swarm with repast)


From: Jan Burse
Subject: Re: polymorphism (was compare swarm with repast)
Date: Mon, 12 Aug 2002 22:38:11 +0200

Dear All

> much in the same way you can use "instanceof" or "implements" in
> Java, except the protocols and the dynamic binding allow for a
> little more flexibility w.r.t. when these determinations happen.....

Check out the package java.lang.reflect. You can also discover
the methods and fields of an object in Java. It is very simple, for
example if you have an object foo and you want to call an arbitrary
method bar(), just do this:

   Class clazz=foo.getClass();
   Method method=clazz.getMethod("bar",new Class[]{});
   method.invoke(foo,new Object[]{});

Reflection, introspection, metadata, etc.. old topics in oo systems,
and quite elegantly solved in Java which is still runtime typesafe
even with the package java.lang.reflect!

Best Regards
--
Jan Burse
Mühlegasse 15
8001 Zürich
fixnet: +41-43-268 04 03
natel: +41-76-316 46 39




                  ==================================
   Swarm-Modelling is for discussion of Simulation and Modelling techniques
   esp. using Swarm.  For list administration needs (esp. [un]subscribing),
   please send a message to <address@hidden> with "help" in the
   body of the message.
                  ==================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]