Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re: quick question about @ and @@
Bertram Scharpf
5/18/2007 11:50:00 PM
Hi,
Am Freitag, 18. Mai 2007, 01:20:26 +0900 schrieb Mike Steiner:
> What's the difference between @ and @@?
class C
@a, @@a = 3, 33
def set_a x, y ; @a, @@a = x, y ; end
def dump ; puts "#@a, #@@a" ; end
def self.dump ; puts "#@a, #@@a" ; end
end
C.dump
puts
c = C.new
d = C.new
c.set_a 7, 77
d.set_a 8, 88
c.dump
d.dump
C.dump
The output is:
3, 33
7, 88
8, 88
3, 88
Bertram
--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: quick question about @ and @@
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password