On 14/05/07, Charley Baker <[EMAIL PROTECTED]> wrote:
> class LoginInput
>   @@user_name = "Vipul.Goyal"
>
>   def LoginInput.user_name
>     @@user_name
>   end
> end
>
> puts LoginInput.user_name
> => "Vipul.Goyal"
>
> # Now with instance:
> class LoginInput
>   @@user_name = "Vipul.Goyal"
>
>   def user_name
>     @@user_name
>   end
> end
>
> l = LoginInput.new
> puts l.user_name
> => "Vipul.Goyal"

Hi Charley,

I looked at this http://www.rubycentral.com/book/tut_classes.html and
it seems to validate the structure of your code. My question then is;
does Ruby not allow short-cut accessor methods (attr_reader,
attr_writer, attr_accessor) for class variables? And if so, why are
they created and used only for instance variables?

cheers

aidy
_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to