Delegate of/Pointer to object instance

D

Dominik Gallus

Hey there,

What i know is that a delegate is a (address)reference to a method or a
object-instance's method.

But how can i have a reference JUST to a object instance? Is this also
done by delegates?

Thanks in advance,
Dominik
 
P

Peter Duniho

What i know is that a delegate is a (address)reference to a method or a
object-instance's method.

But how can i have a reference JUST to a object instance? Is this also
done by delegates?

I don't really understand the question. You can't _not_ have a reference
to an object instance. If you have a variable that is assigned to an
reference type object instance, then that variable contains a reference to
the instance. You can't use an object instance without having a reference
to it.

Pete
 
C

christery

As I gather an object is the house drawing, in instance is the
house...
so you cant get the ref to the drawing (there is nothing built) but to
the new (instance) house when its created
I don't really understand the question. You can't _not_ have a reference
to an object instance. If you have a variable that is assigned to an

But why you cant have a reference to a public instansiated object
instance beats me...

Using its public methods should be ... basic

as always *im in the wrong*

//CY Who stole chr$(12)?
 
J

Jon Skeet [C# MVP]

As I gather an object is the house drawing, in instance is the
house...

No, a class itself is the blueprint, an object (or instance) is an
actual constructed house, and a reference is like the address of a
particular house.
so you cant get the ref to the drawing (there is nothing built) but to
the new (instance) house when its created

Yes. That's a reference to the object.
But why you cant have a reference to a public instansiated object
instance beats me...

That's because you can - but it has nothing to do with delegates. It's
just what you get for free, for all reference types.
Using its public methods should be ... basic

as always *im in the wrong*

I'm afraid I really think you are.

See http://pobox.com/~skeet/csharp/references.html and see if it helps.
 
C

Cor Ligthert[MVP]

Dominic,

ComboBox ExtraReferenceToComboBox = ComboBox1;

Both are now references to the Combobox1
(As simple as it is)

In fact two keys for your house.
(What I always try to avoid by the way)

:)

Cor
 

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

Top