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.
All objects have a header, that among other things, include info on the class type -- and super, interfaces, etc. So, during assignment to a reference, the type is checked, and if incorrect, throws an exception.
Henry Wong wrote:
All objects have a header, that among other things, include info on the class type -- and super, interfaces, etc. So, during assignment to a reference, the type is checked, and if incorrect, throws an exception.
Henry
Joined: Aug 09, 2008
Posts: 8
[Post New]posted Yesterday 9:13:25 PM
Quote Edit
class Display
{
void display()
{
System.out.println("hi");
}
}
class Disp1 extends Display
{
void disp1()
{
System.out.println("hi1");
}
}
class
}
}
in this example "b" reference check the header of type disp1 and it matches disp1 type so it compiles fine even "a" reference can point to both disp1 and display and object is display so it should compile but it fails why ?
please explain me detail?
shankar dengi wrote:
in this example "b" reference check the header of type disp1 and it matches disp1 type so it compiles fine even "a" reference can point to both disp1 and display and object is display so it should compile but it fails why ?
please explain me detail?
If this is the jist of your question, then this topic is a duplicate. Please don't double post... use the other topic as that already received a response.