Re: problem with array template


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

Posted by Anthony Zucaro on March 22, 2001 at 19:25:25:

In Reply to: Re: problem with array template posted by Daniel Longest on March 20, 2001 at 22:46:59:

yeah i'm having the same problem i think...mostly when using [ ], but i find that it gets angry when i use == as well. the compiler flags it, saying that using [ ] yields a template object for some reason. this is only when i'm allocating the template dynamically. statically when i use [ ] and == it works fine (meaning that [ ] yields a book or author instead). does this describe your problem too?

: I'm somewhat confused by exactly what you've done but if I assume you want something like you've tried, that would seem to show that bookArray is an array of pointers to books, in which case you could say (*bookArray[index]).getIsbn to call getIsbn (or you could say bookArray->[index].getIsbn).

: Daniel

: : hi all, in my database class i have pointers to arrayT* and arrayT* which are declared off the heap in the constructor for database class --- i've overloaded the [] operator in the array template, but am having a problem getting the syntax right to access the data in the array -- since the arrays are declared dynamically i have assumed that to access say a member function in the book class ex: bookClass::getIsbn would be bookArray*[index].getIsbn -- yet this will not compile -- any ideas?




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 ]