Re: When I have a pointer to my template class, it only holds the right value in the function it was declared in..


[ Follow Ups ] [ Post Followup ] [ CS2704 Web Discussion Board ] [ FAQ ]

Posted by William D McQuain on March 28, 2001 at 07:48:17:

In Reply to: When I have a pointer to my template class, it only holds the right value in the function it was declared in.. posted by Anuj on March 25, 2001 at 01:49:44:

: I have declared ArrayT *authorArray; as a private data member of my database class. I initiate an object of my template class (which is ArrayT) using the declaration: ArrayT *authorArray = new ArrayT(authorsize);

So you just declared a pointer that's LOCAL to that function... and therefore has no relationship to the data member of the class.

Now when I check the value of a private data member of the ArrayT class (using a get function), I get the expected value, in the scope of the function that I declared the statement. If I try to use that pointer, and the get function with a command like:
: int x = authorArray->getelement(); , I do not get the value that I expect. Its like the value was lost, and I'm not sure why. Anyone know what could be going on?




Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS2704 Web Discussion Board ] [ FAQ ]