Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #3192

Re: Partially overriding a method?

From Roedy Green <see_website@mindprod.com.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Partially overriding a method?
Date 2011-04-21 12:59 -0700
Organization Canadian Mind Products
Message-ID <cv21r61bkjug7jiv5llsammo0735h8rdrr@4ax.com> (permalink)
References <ea560a6d-7156-4801-87c5-3b533b57c420@cu4g2000vbb.googlegroups.com>

Show all headers | View raw


On Thu, 21 Apr 2011 08:31:46 -0700 (PDT), "raphfrk@gmail.com"
<raphfrk@gmail.com> wrote, quoted or indirectly quoted someone who
said :

>I was wondering if it is possible to override a method but only for
>certain sub-classes of the method that the super-class supports.

To get that sort of effect, create new methods with new names.

You can "rescue" a method being overridden, to give access to the
parent method, by creating a method with a new name or signature in
the same class you overrode the base method that calls the parent
method with super.xxxx.

-- 
Roedy Green Canadian Mind Products
http://mindprod.com
Politicians complain that Kindles and iBooks are killing jobs by 
destroying the paper book industry.  I see it that they have create a way 
to produce books for less than a third the cost without destroying forests 
and emitting greenhouse gases in the process.  They have created wealth.  
They are encouraging literacy and cutting the costs of education.  

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Partially overriding a method? "raphfrk@gmail.com" <raphfrk@gmail.com> - 2011-04-21 08:31 -0700
  Re: Partially overriding a method? Lew <noone@lewscanon.com> - 2011-04-21 12:42 -0400
  Re: Partially overriding a method? markspace <-@.> - 2011-04-21 11:37 -0700
    Re: Partially overriding a method? Lew <noone@lewscanon.com> - 2011-04-21 15:58 -0400
  Re: Partially overriding a method? Michal <kleku75@gmail.com> - 2011-04-21 21:00 +0200
  Re: Partially overriding a method? Roedy Green <see_website@mindprod.com.invalid> - 2011-04-21 12:59 -0700
  Re: Partially overriding a method? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-04-21 21:10 -0400
    Re: Partially overriding a method? "raphfrk@gmail.com" <raphfrk@gmail.com> - 2011-04-24 09:39 -0700

csiph-web