This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I read about Casting and converting in RHE book. I understood what they were talking about. But when I was trying to solve some questions from DAN's mock exam I am not able to do anything. I am getting confused at using interfaces when we are doing object refrence. I understood object refrence in upward hierarchy is possible not in downwards. Ex class a class b extends a b b1 = new b; a = b1; It is possible because b is a subclass of a. When it comes to Interfaces I have know idea. Thanks for asking me about my confustion part.
zarina mohammad
Ranch Hand
Joined: Jun 26, 2002
Posts: 104
posted
0
When it comes to interface a class can be cast to interface implicitly if the class implements the interface. But explicit conversion is needed to cast an interface to class implementing the interface(which is legal even at runtime) or to a class not implementing the interface(illegal at runtime) this example might help you understand better