473,320 Members | 1,600 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

object, reference, instance

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
6 2197
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
"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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
by: Daniel | last post by:
Hello =) I have an object which contains a method that should execute every x ms. I can use setInterval inside the object construct like this - self.setInterval('ObjectName.methodName()',...
6
by: Martin | last post by:
I'd like to be able to get the name of an object instance from within a call to a method of that same object. Is this at all possible? The example below works by passing in the name of the object...
15
by: Carlos Lozano | last post by:
Hi, What is the right way to create an OCX COM component. The component is already registerred, but can't create an instance. I am using the reference to the interop module created. If I use...
3
by: Adam | last post by:
We have a web site that uses .vb for the web pages and .cs for a class module. We are getting the error in .NET 2.0 and VS 2005 beta 2. It does work with .NET 1.1. When trying to access a page...
4
by: Luke Matuszewski | last post by:
Here are some questions that i am interested about and wanted to here an explanation/discussion: 1. (general) Is the objectness in JavaScript was supported from the very first version of it (in...
12
by: Andrew Poulos | last post by:
With the following code I can't understand why this.num keeps incrementing each time I create a new instance of Foo. For each instance I'm expecting this.num to alert as 1 but keeps incrementing. ...
6
by: Shailen Sukul | last post by:
Observed a weird behaviour with object references. See code listing below: using System; using System.Collections.Generic; using System.Text; namespace PointerExceptionTest { /*
14
by: Philipp Reif | last post by:
Hi all, I've got a little hole in my head concerning references. Here's what I'm trying to do: I'm calling a function, passing the reference of a business object for editing. The function clones...
3
by: User1014 | last post by:
A global variable is really just a property of the "Global Object", so what does that make a function defined in the global context? A method of the Global Object? ...
2
by: Ralph | last post by:
Hi I don't understand why it's not working: function schedule(imTop){ this.tdImagesTop = imTop; } schedule.prototype.selectEl = function() { alert(this.tdImagesTop);
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.