Re: weird error


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

Posted by John Kugelman on March 23, 2001 at 10:17:41:

In Reply to: Re: weird error posted by Anthony Zucaro on March 23, 2001 at 07:43:34:

: : If that's what you mean (the errors you mention would apply), don't forget to dereference the pointer before you try to access the template class members. 'Array *' is not the same type as 'Array '.

: : ArrayTemplate < Book or Author > * DB;
: ArrayTemplate < Book or Author > DB(size)
: is this a simple de-referencing problem?

Yep, it is.

If you don't understand why, think about it this way. If you hide the array template behind a 'typedef' like

  typedef ArrayT Array

then your two declarations look like

  Array static_array;
    and
  Array *dynamic_array;

Right? You have to deference the pointer to get to the array template.


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 ]