No. The way you are doing means you are calling .toURL() method on what ever is returned by the method getThumb(). Unless getThumb returns a type of Object of type SuperOne or it's sub-class you cannot call this method and you should see a compile time error.
 
What you can do is
 
URL url = toURL( myImage.getThumb() ); in your SuperOne or its sub-class.
 

===
Gary Grewal

-----Original Message-----
From: Ryan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 22, 2001 10:38 AM
To: [EMAIL PROTECTED]
Subject: Java Question on Inheritance

I don't really know what to call what I'm having trouble with but here is what I am trying to do.
 
I have a superclass called SuperOne, it has a method to convert a string to a URL format called toURL().
 
I have an Image class that is a subclass of SuperOne. It holds a string storing the local path of the image on my harddrive. This subclass contains a method to get the corresponding thumbnail of the image on my harddrive. The method is called getThumb().
 
 
In a third class I want to instantiate an Image object something like:
    Image myImage = new Image("/home/pic.gif");
 
 
Ultimately, I want to get the thumb of this Image and convert it to a URL. I want to be able to do this efficiently and use something like the following syntax.
 
    myImage.getThumb().toURL()
 
 
Is this possible?
 
 
thanx
-ryan

Reply via email to