@@newimpl and @newimpl in Net

G

Ged Byrne

Hi,

Just getting to the bottom of my Net:HTTP problems,
and browsing through the ruby source.

I notice that the Net Module declares @@newimpl for
backward compatability.

However, in several places (such as the HTTP.get
method) @newimpl is referred to.

I know that @@ signified a class variable, and that @
signifies an instance variable.

Can class variables be called freely as instance
variables, or is there a significant difference when
declaring a class variable as an instance variable?

________________________________________________________________________
Want to chat instantly with your online friends? Get the FREE Yahoo!
Messenger http://uk.messenger.yahoo.com/
 
A

Armin Roehrl

I know that @@ signified a class variable, and that @
signifies an instance variable.

Can class variables be called freely as instance
variables, or is there a significant difference when
declaring a class variable as an instance variable?
The big difference is that all instances of one class
share the same class variable, but have their own individual
instance variable.

If you change a class variable, it will change
for all instances of that class.

If you change an instance variable, only the instance variable
of one specific instance will change and not for all the other instances.

bye, -A.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top