[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Mthod redefinition

Meino Christian Cramer

9/12/2003 5:01:00 PM

2 Answers

Robert Klemme

9/15/2003 7:30:00 AM

0


"Meino Christian Cramer" <Meino.Cramer@gmx.de> schrieb im Newsbeitrag
news:20030912.190237.74747709.Meino.Cramer@gmx.de...
> Hi,
>
> I just want to know, whether there is a way to accomplish things like
> "method redefinition" like in C++ (sorry, dont know the exact
> terminus technicus...)

"overloading" is the correct term. "Redefinition" is used for sub class
methods that introduce a new definition for method defined in a super
class.

You''ll find further info at the Wiki:
http://www.rubygarden.org/ruby?R...
http://www.rubygarden.org/ruby?Keywor...

Regards

robert

Mark J. Reed

9/15/2003 2:05:00 PM

0


On Mon, Sep 15, 2003 at 09:29:50AM +0200, Robert Klemme wrote:
> "overloading" is the correct term. "Redefinition" is used for sub class
> methods that introduce a new definition for method defined in a super
> class.

Actually, "redefinition" is a general term for defining a method which has
already been defined somehow; there are many possible ways to do this in
a dynamic language like Ruby. In the specific case of a subclass defining
a method that is also defined in a superclass, the subclass method is
said to "override" the superclass method. Thus we have two unfortunately
similar terms for very different things:

Overloading: distinguishing methods based on arguments/signature

Ruby 1 doesn''t have this; C++ and Java do; Perl6 will, according
to the current design.

Overriding: hiding superclass methods with new implementations

All O-O languages, including Ruby, have this.

-Mark