Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
I am not able to understand that bObject1 is of type boo and it contains a new Foo() which is upcasted to boo and when we call b0bject1.abc()--it is printing the line depending upon what object the reference variable bobject1 has in it...,compiler doesn't take into account the casting....but if i send a new Integer(5) to a method expecting an Object as argument...,I have to downcast and get the Integer object...to be able to call Integer specific methods and if I don't downcast I can only access Object specific methods,so, my question is in this example when Iam upcasting it (please refer line of confusion above) and then call bObject1.abc () why not it is printing "in boo" (that is boo specific method)
hello friend i understood your doubt ; Since the methods are overridden the compiler chooses the method specfic to the object being created and not the reference type when we upcast the reference it is still referring the Foo object and not a boo object. i hope you have understood else please refer to kathy sierra's book for scjp preparation