Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #34462
| Path | csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Robert Klemme <shortcutter@googlemail.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: How to extend an array |
| Date | Sat, 4 Jun 2016 19:17:44 +0200 |
| Lines | 43 |
| Message-ID | <drggppFctmpU1@mid.individual.net> (permalink) |
| References | <ae727260-8c33-4648-8995-f387a6eb8b52@googlegroups.com> <dr914vFsbd4U1@mid.individual.net> <38f6b479-51a0-4bc3-b1f7-f05d3d229f53@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net UzGSsjLCA7twUos2bFd/RgW+u6gPl/B1kfIm3aj8H94p0bBEI= |
| Cancel-Lock | sha1:Bog/JRYLpZ7iT1w1mURh1rsKSMY= |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 |
| In-Reply-To | <38f6b479-51a0-4bc3-b1f7-f05d3d229f53@googlegroups.com> |
| Xref | csiph.com comp.lang.java.programmer:34462 |
Show key headers only | View raw
On 03.06.2016 14:38, Eric Douglas wrote: > On Wednesday, June 1, 2016 at 5:07:55 PM UTC-4, Robert Klemme wrote: >> Is this what you had in mind? > I modified your sample into a runnable static class. It appears that > would work, to put the listeners for both classes into a single > array, with some slight confusion to avoid. You omitted the generic declarations which defies the whole point of using them. You should have noticed by the warnings that you should be getting. > I think the way I wrote it may have more overhead but avoids those > issues, should get a compile error if you try to add the extended > listener to the base class instance, Why? Because the "extended listener" extends the base listener. And it is completely logical that you do _not_ get a compile error. > and should work fine only > executing base listener events if you add the base listener to the > extended class instance. You cannot do that because a BaseListener does not extend DerivedListener. The compiler will prevent this. > I don't think those issues should ever come up, normally we'll only > want a base listener for a base class instance and a derived listener > for an extended class instance, but a lot of problems do come up in > programming when an API allows someone to do something they should > never do. (thorough documentation emphasizing what not to do helps?) I think you still have not grasped it fully how this works. I am not even sure what you are trying to achieve. Can you describe that in plain English? Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to extend an array Eric Douglas <e.d.programmer@gmail.com> - 2016-05-31 07:52 -0700
Re: How to extend an array Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-05-31 11:52 -0400
Re: How to extend an array Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-05-31 11:56 -0400
Re: How to extend an array Eric Douglas <e.d.programmer@gmail.com> - 2016-05-31 09:19 -0700
Re: How to extend an array Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-05-31 14:01 -0400
Re: How to extend an array Eric Douglas <e.d.programmer@gmail.com> - 2016-05-31 09:09 -0700
Re: How to extend an array Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-05-31 14:11 -0400
Re: How to extend an array Eric Douglas <e.d.programmer@gmail.com> - 2016-05-31 11:25 -0700
Re: How to extend an array Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-05-31 17:01 -0400
Re: How to extend an array Eric Douglas <e.d.programmer@gmail.com> - 2016-06-01 04:57 -0700
Re: How to extend an array Roedy Green <inquiry@mindprod.com> - 2016-05-31 21:56 -0700
Re: How to extend an array Eric Douglas <e.d.programmer@gmail.com> - 2016-06-01 04:49 -0700
Re: How to extend an array Robert Klemme <shortcutter@googlemail.com> - 2016-06-01 23:07 +0200
Re: How to extend an array Eric Douglas <e.d.programmer@gmail.com> - 2016-06-03 05:38 -0700
Re: How to extend an array Robert Klemme <shortcutter@googlemail.com> - 2016-06-04 19:17 +0200
Re: How to extend an array Eric Douglas <e.d.programmer@gmail.com> - 2016-06-03 08:52 -0700
csiph-web