Is it not because you are passing an instance of super class while it
expects an instance of a derived class?

-- venkat


On Fri, 4 Feb 2005 17:28:45 +0100, Michael Schuerig <[EMAIL PROTECTED]> wrote:
> On Friday 04 February 2005 12:52, Davanum Srinivas wrote:
> 
> > On Fri, 4 Feb 2005 10:06:11 +0100, Michael Schuerig
> <[EMAIL PROTECTED]> wrote:
> > > On Thursday 03 February 2005 04:27, Davanum Srinivas wrote:
> > > > you can replace xxx.enum.yyy with xxx.constants.yyy
> > >
> > > This only works in cases where one simply uses the constants. It
> > > does not work for variable, field, and parameter types.
> 
> > can u give me an example?
> 
> Try to compile this:
> 
> package test;
> 
> import org.apache.axis.constants.Style;
> 
> public class ConstantsVsEnum {
>    public static final Style myStyle = Style.DOCUMENT;
> 
>    private static void styleTaker(Style style) {
>    }
> 
>    public static void main( String[] args ) {
>        styleTaker(myStyle);
>        styleTake(Style.DOCUMENT);
>    }
> }
> 
> These are the errors you'll probably get:
> 
> test/ConstantsVsEnum.java:7: incompatible types
> found   : org.apache.axis.enum.Style
> required: org.apache.axis.constants.Style
>    public static final Style myStyle = Style.DOCUMENT;
>                                             ^
> test/ConstantsVsEnum.java:14: cannot find symbol
> symbol  : method styleTake(org.apache.axis.enum.Style)
> location: class test.ConstantsVsEnum
>        styleTake(Style.DOCUMENT);
>        ^
> 2 errors
> 
> Michael
> 
> --
> Michael Schuerig                            You can twist perceptions
> mailto:[EMAIL PROTECTED]                        Reality won't budge
> http://www.schuerig.de/michael/               --Rush, Show Don't Tell
>

Reply via email to