I'm a little bit confused using RTTI and Reflection ...
RTTI means:
* Know the class to use and the interface at compiletime
* Usage of instanceof
* Usage of Class
Reflection means:
* No knowledge about the class to use at compiletime -> usage of
java.lang.reflection.*
* Usage of Class
Main difference is the knowledge / missing knowledge of the class to use or
its internal
structure. Am I right ?
Thx, Michael.
Don't be. They are essentially the same. RTTI is a term from C++ heritage,
and Reflection from the "pure" OO heritage. Typically, reflection implies a
greater level of control than RTTI. Java's implementation falls somewhere
between the capabilities of RTTI and Reflection, but has been given the name
reflection by Sun.
Historically, Java did not have all of its reflection abilities that it
currently does until version 1.1 -- so book authors describing the 1.0
abilities (which were far more limited and not yet named) applied the term
RTTI to refer to them. Some people still try to make a distinction between
1.0 compatible type information and "reflection", but it makes more sense to
consider the whole thing (including Class and even the instanceof operator)
to be reflection.
Chris Smith
Thank you for your answer. I felt that RTTI and reflection are basically the
same.
But Bruce Eckel in his book "Thinking in java" didn't make it as clear.
Your answer brought me the light ;-)))
RU,
Michael.
"Chris Smith" <cds...@twu.net> schrieb im Newsbeitrag
news:9flpp0$uv8$0...@pita.alt.net...