Question About temlates.
From: Joec (joec_at_annuna.com)
Date: 02/26/04
- Next message: Joec: "Re: Why is standard library hidden?"
- Previous message: Josh Sebastian: "Re: [C++] Linkage Error w/ Code Sample from Lippman..."
- Next in thread: Jeff Schwab: "[C++] Re: Question About templates."
- Reply: Jeff Schwab: "[C++] Re: Question About templates."
- Reply: Leor Zolman: "Re: Question About temlates."
- Reply: Chris \( Val \): "Re: Question About temlates."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 26 Feb 2004 00:39:02 GMT
I am trying to rewrite part of the standard library. Not fully, I am
still new at this, but what I want to do is create a template class that
will act like a dynamic array. I have gotten it to work with integers
but I am having trouble with changing the variables from int to T.
template <class T> class box{
int size;
T* parray;
public:
box();
box(const box& cbox);
~box();
void put(T add);
T read(int num);
int size();
}
box::box()
size = 0;
T* parray = new T[size + 1];
}
box::box(const box& cbox){
cout<<"Copy Constructor...\n";
narry = new cls;
int nsize = size;
*narry = *parry;
}
....
All I want to do is get a given type and store it in a dynamic array.
Where am I going wrong?
- Next message: Joec: "Re: Why is standard library hidden?"
- Previous message: Josh Sebastian: "Re: [C++] Linkage Error w/ Code Sample from Lippman..."
- Next in thread: Jeff Schwab: "[C++] Re: Question About templates."
- Reply: Jeff Schwab: "[C++] Re: Question About templates."
- Reply: Leor Zolman: "Re: Question About temlates."
- Reply: Chris \( Val \): "Re: Question About temlates."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|