aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Function Overriding Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Function Overriding" Watch "Function Overriding" New topic
Author

Function Overriding

harmeet saini
Ranch Hand

Joined: Apr 11, 2010
Posts: 33
Hi

Following is a code from CertPal, i am not able to understand why the following code gives me a compile time error


Regards,
Harmeet Singh
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

Why don't you get the Error with the help of the Compilation Error? What about your 10th line? Is it legal? Check it.


|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Prasad Kharkar
Ranch Hand

Joined: Mar 07, 2010
Posts: 438

we cannot refer to object of super type using subclass type reference
that is why the compiler complains

SCJP 6 [86%] June 30th, 2010
If you find any post useful, click the "plus one" sign on the right
Shanky Sohar
Ranch Hand

Joined: Mar 17, 2010
Posts: 1046


Brain pain = new Stain(); pain.stake();

as brain extends stain(); //////so brain ISA stain;

this line gives error as the supertype object cannot be refer from a subtype reference......


SCJP6.0,My blog Ranchers from Delhi
harmeet saini
Ranch Hand

Joined: Apr 11, 2010
Posts: 33
Thnks to all.... jus got my doubt clear
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Function Overriding
 
Similar Threads
About Overridden methods...
Accessing a class from within the package
Base Class variable
static block and constructor problem
scjp - Threads