[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: Class & modifiers modifiers

Yukihiro Matsumoto

1/25/2007 3:55:00 PM

Hi,

In message "Re: Class & modifiers modifiers"
on Thu, 25 Jan 2007 23:58:09 +0900, Miquel <ktalanet@yahoo.es> writes:

|module A
|
| protected
|
| def b_method()
| return 'foo->A'
| end
|
|end
|
|class B
| include A
|
| def b_method()
| return 'foo->B'
| end
|
|end
|
|Is B's method b_method() protected? Is it public? What the hell is this
|method (;-) ) ?

public. I don't recommend to override protected method though.

matz.

1 Answer

Miquel Oliete

1/25/2007 4:13:00 PM

0

EL Fri, 26 Jan 2007 00:55:18 +0900
Yukihiro Matsumoto <matz@ruby-lang.org> escrigué:

> Hi,
>
> In message "Re: Class & modifiers modifiers"
> on Thu, 25 Jan 2007 23:58:09 +0900, Miquel <ktalanet@yahoo.es>
> writes:
>
> |module A
> |
> | protected
> |
> | def b_method()
> | return 'foo->A'
> | end
> |
> |end
> |
> |class B
> | include A
> |
> | def b_method()
> | return 'foo->B'
> | end
> |
> |end
> |
> |Is B's method b_method() protected? Is it public? What the hell is
> this |method (;-) ) ?
>
> public. I don't recommend to override protected method though.
>

Why not?

You might have a protected method in a module which has no code or
only an exception (something like an abstract method in Java/C#) and has
a different behaviour in the different classes which include it. In this
case it must have been overriden.

What do you think about this?

Btw, congratulations for this awesome language you have written.


> matz.
>
Miquel


______________________________________________
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y m?viles desde 1 c?ntimo por minuto.
http://es.voice...