-
template help
Hi,
I'm reading about template. And here's a bit of code that I don't understand. It's a code for a stack.
Code:
template <class Type>
class Stack
{
private:
enum{SIZE = 10};
int stack_size;
Type * items;
int top;
.
.
.
and in main, it would say:
Code:
Stack<const char*> st;
If I pass "const char *" into the template, would that make "items" type "char **"?
-
That should make items of type "const char **".
-
To be fair, it would make items of type const char*. That's what you push and pop. The internal representation of that stack if using a pointer to that type, const char*, so yes, it would be const char**.
-
thank you guys for the quick reply. I got it now.