Pages

Wednesday, December 22, 2010

ruby class

string converting into  symbol
      p.to_sym
  and Instance variable :class(variable)instance variable.


  attr_reader:first_value (or)getter value
  onother one is attr_writer_value


pgm    in pnr simple interest

           class sample
               def initialize=(p,n,r)
               @p=p
               @n=n
                @r=r
                s=(@p*@n*@r)/100
               put s
             end
           end

No comments:

Post a Comment