I had a discussion with a coworker today, whether usage of using the Java operator instanceof
is a kind of reflection. And the discussion quickly evolved into what actually defines reflection.
So, what is the definition of reflection?
And is the usage of instanceof
considered "using reflection" ?
And in addition, if instanceof
is considered reflection, then is polymorphism not also "using reflection"? If not, what is the difference?
instanceof
is an example of reflection. Certainly it is somewhere between normal data use and metadata use viagetClass()
& friends, but you can have workable definitions wither way.return
considered "structural programming"?