By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,836 Members | 2,011 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,836 IT Pros & Developers. It's quick & easy.

object, reference, instance

P: n/a
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

Jan 18 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
hi,

kalaivanan wrote:
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 <--
Jan 18 '07 #2

P: n/a
"kalaivanan" <ma********@gmail.coma écrit dans le message de news:
11********************@m58g2000cwm.googlegroups.co m...

| 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

--
Joanna Carter [TeamB]
Consultant Software Engineer
Jan 18 '07 #3

P: n/a
Hello kalaivanan,

http://www.answers.com/instance%20computer%20science
http://www.answers.com/reference%20computer%20science
---
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

khi,
ki am a beginner in c#.
ki have theoretical knowledge about object, reference and instance.
kbut i want to know clearly about what is an object, reference and
kinstance.
kcan any one help me?
kor is there any article which can explain it.
kkalaivanan
k>
Jan 18 '07 #4

P: n/a
Jay
"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?

"Stefan Hoffmann" <st*************@explido.dewrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
hi,

kalaivanan wrote:
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 <--
Jan 18 '07 #5

P: n/a
hi Jay,

Jay wrote:
>"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?
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 <--
Jan 18 '07 #6

P: n/a
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.

--
Dave Sexton
http://davesexton.com/blog

"Stefan Hoffmann" <st*************@explido.dewrote in message
news:ev**************@TK2MSFTNGP04.phx.gbl...
hi Jay,

Jay wrote:
>>"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?
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 <--

Jan 18 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.