Re: 1.5 generic question

From: Thomas A. Li (tli_at_corporola.com)
Date: 12/18/03

  • Next message: Karl von Laudermann: "Re: Problems with Ant, strange effects"
    Date: Thu, 18 Dec 2003 18:34:44 GMT
    
    

    That is what OO inheritance means.
    It works one way only. Try the other direction.

    "Chris" <sarge_chris@hotmail.com> wrote in message
    news:568394b1.0312170319.bd4959a@posting.google.com...
    > Has anyone had a play with generics in the JDK1.5 beta-release and/or
    > knows the answer to this:
    >
    > If I have the following:
    >
    > // immutable
    > interface Address
    > {
    > String getStreet() { ... }
    > ...
    > }
    >
    > // mutable
    > class MutableAddress implements Address
    > {
    > String getStreet() { ... }
    > void setStreet( String street ) { ... }
    > }
    >
    > then using generics I could define this:
    >
    > private List<MutableAddress> list;
    >
    > but could I 'down-cast' this list to do the following:
    >
    > List<Address> getList() { return list; }
    >
    > i.e. the client will only get the immutable base-class.
    >
    > Any ideas?
    >
    > - sarge


  • Next message: Karl von Laudermann: "Re: Problems with Ant, strange effects"

    Relevant Pages

    • Re: What doesnt lend itself to OO?
      ... >> service on the internet and simply accessed a clock, ... > single, resource-limited server. ... If the clock service has identity then the client looks like... ... >> because there is no temptation to use implementation inheritance to ...
      (comp.object)
    • Re: Firewall Client Question
      ... The software install is turning off inheritance. ... > The default registry and file permissions are outside the scope of a ... > client configuration. ... > the Registry Key and Everyone Full Control. ...
      (microsoft.public.isa.clients)
    • Re: Firewall Client Question
      ... Not correct are users are not Local Admins or even Power Users and they have ... the Registry Key and Everyone Full Control. ... > The problem here is that his users are local admins on the client machines ... > Turn Inheritance on at the Folder and change Everyone to Read ...
      (microsoft.public.isa.clients)