object, reference, instance

  • Thread starter Thread starter kalaivanan
  • Start date Start date
K

kalaivanan

hi,
i am a beginner in c#.
i have theoretical knowledge about object, reference and instance.
but i want to know clearly about what is an object, reference and
instance.
can any one help me?
or is there any article which can explain it.

kalaivanan
 
hi,
i am a beginner in c#.
i have theoretical knowledge about object, reference and instance.
but i want to know clearly about what is an object, reference and
instance.
Object and instance are synonymic.

An object or an instance is the encapsulated code and data "living" in
your computers memory.

An object or an instance is the "living" form of a class.

A reference is a pointer to an object. So a reference tells you where to
find your object. A simple pointer is a memory address. At this address
you will find your referenced object or instance.


mfG
--> stefan <--
 
"kalaivanan" <[email protected]> a écrit dans le message de (e-mail address removed)...

| i have theoretical knowledge about object, reference and instance.
| but i want to know clearly about what is an object, reference and
| instance.
| can any one help me?
| or is there any article which can explain it.

This is a class

public class Person
{
///
}

It is a description of a Person, a sort of template from which Person
objects or instances can be created. Think of a Class as a cookie cutter and
the objects or instances it creates as the cookies.

Object and Instance are interchangeable terms for the things that a Class
creates.

{
Person p = new Person();

...
}

p is a reference or variable that holds an object or instance.

public class Person
{
private string name;

...
}

In this example, name is a string Field, which is a variable held inside an
instance of the Person class.

There's more, but does that help ?

Joanna
 
Hello kalaivanan,

http://www.answers.com/instance computer science
http://www.answers.com/reference computer science


---
WBR,
Michael Nemtsev [C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

k> hi,
k> i am a beginner in c#.
k> i have theoretical knowledge about object, reference and instance.
k> but i want to know clearly about what is an object, reference and
k> instance.
k> can any one help me?
k> or is there any article which can explain it.
k> kalaivanan
k>
 
"An object or an instance is the encapsulated code and data "living" in your computers memory."

Does an object actually contain code too? I've always assumed that an object only contained data,
and that all of the code was common to all objects of the same class, so there is only one set of
code that all objects used. Perhaps I made a bad assumption?



hi,
i am a beginner in c#.
i have theoretical knowledge about object, reference and instance.
but i want to know clearly about what is an object, reference and
instance.
Object and instance are synonymic.

An object or an instance is the encapsulated code and data "living" in
your computers memory.

An object or an instance is the "living" form of a class.

A reference is a pointer to an object. So a reference tells you where to
find your object. A simple pointer is a memory address. At this address
you will find your referenced object or instance.


mfG
--> stefan <--
 
hi Jay,
Does an object actually contain code too? I've always assumed that an object only contained data,
and that all of the code was common to all objects of the same class, so there is only one set of
code that all objects used. Perhaps I made a bad assumption?
This depends of your point of view:

In computer sciences this is true. As an instance is only the input, so
it is the data only.

In OO this must not be true, e.g. an object able to self modify its code.
But at this point i'm not sure if any of the common OO languages
supports self modification.


mfG
--> stefan <--
 
Hi,

In .NET, "code", or CIL, is defined by the entity definition (class, struct,
enum or delegate)

An "instance" is a tangible, in-memory construct of a particular class.

"object" is the base type of all classes, when speaking of types, but is
also used to refer to "instances" of any type, loosely.
 
Back
Top