Re: Covariant Return Types
[email protected] Thu, 4 Mar 2004 17:44:18 -0600
| Newsgroups | gmane.comp.lang.nice.general |
|---|---|
| Message-ID | <[email protected]> |
Quoting Daniel Bonniot <[email protected]>: > > > package a; > > class A { } > > class B extends A { } > > A self(A a) = a; > > B self(B b) overrides A self(A) = b; > > > > void main(String [] args) { > > let x = self(A); // syntax? > > let y = self(B); // syntax? > > println(x == y); > > } > > > >Do I get "true" or "false"? > > > You get: "A is not a value" a the first line with the comment :-) > > What do you mean? self(new A()) ? I mean, "let x be a reference to the method with type A -> A" and "let y be a reference to the method with type B -> B." - Brian ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click