object, reference, instance

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • kalaivanan

    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

  • Stefan Hoffmann

    #2
    Re: object, reference, instance

    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 <--

    Comment

    • Joanna Carter [TeamB]

      #3
      Re: object, reference, instance

      "kalaivanan " <mail2kalai@gma il.coma écrit dans le message de news:
      1169113460.8508 15.6320@m58g200 0c...legrou ps.com...

      | 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


      Comment

      • Michael Nemtsev

        #4
        Re: object, reference, instance

        Hello kalaivanan,

        Answers is the place to go to get the answers you need and to ask the questions you want

        Answers is the place to go to get the answers you need and to ask the questions you want



        ---
        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>


        Comment

        • Jay

          #5
          Re: object, reference, instance

          "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" <stefan.hoffman n@explido.dewro te in message
          news:%23n6RbiuO HHA.3268@TK2MSF TNGP03.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 <--


          Comment

          • Stefan Hoffmann

            #6
            Re: object, reference, instance

            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 <--

            Comment

            • Dave Sexton

              #7
              Re: object, reference, instance

              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


              "Stefan Hoffmann" <stefan.hoffman n@explido.dewro te in message
              news:evwhqUwOHH A.4372@TK2MSFTN GP04.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 <--

              Comment

              Working...