i wonder if i should realized threads by
1) extending the Thread class or
2) implementing the Runnable interface and start them with (new
Thread(myThreadObject)).start()
what are the pros and cons? can anybody help me?
for case 2): how can i still keep control about my own defined member
variables and methods?
thanks
matthias
--
Matthias Jung
Institut Eurecom
2229 Route des Cretes; BP 193
F-06904 Sophia Antipolis Cedex
Tel: +33 4.93.00.26.31
E-mail: ju...@eurecom.fr
http://www.eurecom.fr/~jung/
Use Runnable.
Extend Thread only when you want to extend the capabilities of
threads, i.e., when you are going to do something like:
ExtendedThread(aRunnableObject).start();
Why? Because the whole idea of inheritance is that the subclass
is some kind of specialization/extension of the parent.
I'm not sure I understand your question about controlling
your member variables and methods. The only thing that the
Runnable interface requires is that your class have a run method.
Otherwise you are free to design the class in any way you wish.
Hope this helps,
Yours,
Tom McGlynn
t...@silk.gsfc.nasa.gov