Pushing a record into an inst. vaariable.

Discussion in 'Ruby' started by mosar, Sep 4, 2008.

  1. mosar

    mosar Guest

    In a study(#31) published by the American Accounting Association, prof
    Ijiri
    has suggested a new way to treat accounting transactions by mean of
    asymetrical arrays and using wealth and income accounts instead of
    debit and credit accounts.
    In a little program I have tried to to use this kind of approach.My
    first program contains two classes: a class Account and and class
    Records.
    In the first part of my program (class Account part) I have introduced
    an initialize method and a balance methods.Furthermore there is
    another method whis is:

    def add_record(record)
    @records<< record
    end

    The class Record part of the program contains these two lines of
    program:
    mosar, Sep 4, 2008
    #1
    1. Advertising

  2. On Thu, Sep 4, 2008 at 8:04 AM, mosar <> wrote:
    > In a study(#31) published by the American Accounting Association, prof
    > Ijiri
    > has suggested a new way to treat accounting transactions by mean of
    > asymetrical arrays and using wealth and income accounts instead of
    > debit and credit accounts.

    As a former student of accounting this sounds rather interesting.

    > In a little program I have tried to to use this kind of approach.My
    > first program contains two classes: a class Account and and class
    > Records.
    > In the first part of my program (class Account part) I have introduced
    > an initialize method and a balance methods.Furthermore there is
    > another method whis is:
    >
    > def add_record(record)
    > @records<< record
    > end
    >
    > The class Record part of the program contains these two lines of
    > program:
    > .
    > .
    > wealth_account.add_record(self)
    > income_acount.add_record(self)
    >
    > .
    > .

    If I had to take a wild guess, I assume these two lines are located
    inside an instance method of the Record class, correct?

    > It means that the two objects wealth_account and income_account call
    > the def add-record method.
    > What I don't understand is, if instead of the word record I put any
    > word like a, x it is working properly. My question is: how does the
    > program know that it has to go to the lines of code where I
    > instantiate the records. As the user I know where I can find the
    > records but there is no special flags which indicate these lines.
    >

    The program does not automatically create an instance of Record when
    you say "weath_account.add_record(self)". At this point the instance
    of the record has to have already been constructed, if you're
    referencing it with self.

    This is very confusing, maybe you could try and clarify the situation
    a bit more? The more code you can post the better...

    HTH,
    Michael Guterl
    Michael Guterl, Sep 4, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dag Sunde
    Replies:
    0
    Views:
    847
    Dag Sunde
    Dec 3, 2003
  2. =?Utf-8?B?UGF0cmljay5PLklnZQ==?=

    System.NullReferenceException: Object reference not set to an inst

    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Oct 6, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    3,565
    Ken Dopierala Jr.
    Oct 6, 2004
  3. =?Utf-8?B?UGF0cmljay5PLklnZQ==?=

    System.NullReferenceException: Object reference not set to an inst

    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Nov 5, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    508
    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=
    Nov 5, 2004
  4. =?Utf-8?B?QmVu?=
    Replies:
    2
    Views:
    1,935
    =?Utf-8?B?QmVu?=
    Feb 2, 2005
  5. Black Baptist
    Replies:
    5
    Views:
    2,311
    Black Baptist
    Jan 14, 2005
Loading...

Share This Page