> I never heared about Object Overloading in Java but in one of my
> interview i was asked about this. Though I said no, the interviewer
> insisted it is there but he did not tell how...
>
> Can you tell me is there anything called Object Overloading in Java?
I haven't heard this term either. The term does seem to be used in PHP
land quite a bit as Google reveals, e.g.
http://www.onlamp.com/pub/a/php/2005/06/16/overloading.html
Though I have to say that I would not consider PHP related texts an
authoritative source on OO terms. ;-)
I'd say, either the interviewer was not proficient in Java and used an
unfamiliar term (he probably meant method overloading) or he tried to
see how you react to a silly question. My 0.02EUR.
Kind regards
robert
subi - 04 Mar 2007 07:06 GMT
> > I never heared about Object Overloading in Java but in one of my
> > interview i was asked about this. Though I said no, the interviewer
[quoted text clipped - 16 lines]
>
> robert
Thank you Robert. I too was confused...but as you said i think the
interviewer may not proficinet in Java :)
Chris Uppal - 04 Mar 2007 18:09 GMT
> > Can you tell me is there anything called Object Overloading in Java?
>
[quoted text clipped - 4 lines]
> Though I have to say that I would not consider PHP related texts an
> authoritative source on OO terms. ;-)
And it seems to mean something /really/ weird to the PHPers. Not that the idea
of a default handler for undefined method calls is weird in itself, but calling
that technique "object overloading" makes no sense at all to me.
-- chris
> I never heared about Object Overloading in Java but in one of my
> interview i was asked about this. Though I said no, the interviewer
> insisted it is there but he did not tell how...
>
> Can you tell me is there anything called Object Overloading in Java?
There is no such term in standard use, either specific to Java or in OO
programming in general.
In fact I have no real idea what it is even /intended/ to mean. The
interviewer might have been referring to method overloading (in which case I
suspect he knows not very much about Java or OO programming, since "object" and
"method" are not even close in meaning). Or he may have been trying to talk
about ordinary OO polymorphism, where two objects may implement the "same"
operation in different ways. Or it could have been a fumbled attempt to say
"operator overloading". Or he may have meant something else entirely...
Doesn't sound like a good place to work...
-- chris
subi - 04 Mar 2007 07:09 GMT
> > I never heared about Object Overloading in Java but in one of my
> > interview i was asked about this. Though I said no, the interviewer
[quoted text clipped - 16 lines]
>
> -- chris
Thank chris...The interviewer insisted he did not mean other
overloading but object overloading. But i think the interviewer wanted
to paly a fool play..
Tor Iver Wilhelmsen - 04 Mar 2007 13:38 GMT
The only interpretation of "object overloading" I can think of is
something like Lisp's "let", which sets up a calling environment where the
world looks different. However, this would be impossible in Java because
each method call is isolated (except through parameters passed and the
return value if any) so if a method used (pseudo-Java)
this.foo = new Foo();
let {
this.foo = null;
}
for {
this.doSomethingWithFoo(); // 1
}
this.doSomethingWithFoo(); // 2
the method doSomethingWithFoo(); would see the same value in both calls.
Ideally call 1's manipulation of the null foo would be "forgotten" when
the block exited, but this is complicated by multithreading (i.e. if you
synthesized setting and resetting before and after the block, another
thread would "see" the wrong (null) value if it executed the same time as
the block).
You could emulate it by using a "context" object instead of instance
variables, and passing that context around, but then you are really trying
to reimplement Lisp in Java. :)