but when you do that all hell breaks loose


[ Follow Ups ] [ Post Followup ] [ CS328 Message Board ] [ FAQ ]

Posted by kalpol on July 16, 2001 at 09:49:37:

In Reply to: Re: printing the number of references posted by Emerson on July 16, 2001 at 04:47:03:

: : all-
: : how does van wieren's test.cpp file print out the number fo references to a foo object? i mean, when it says
: : cout << "Handler indicated that " << pid << " now has " << references << " references to that foo." << endl;
: : how does the compiler know what value is stored in references? i see the line where
: : result=test_handler_ptr->create_foo(pid, dataone, references);
: : but i don't see how or where references is defined.
: : thanks for any help

:
: the "unsigned long int& references" argument for create_foo() (and also remove_foo()) is passes by reference (indicated by the &).

: you're supposed to change the value for the references variable within your foohandler's create_foo() function to reflect the value you have stored.

but when you do that, the next time a foo is created it has as many references as the last one, and then everything goes all to hell post-haste bcause the number doubles.



Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS328 Message Board ] [ FAQ ]