template <class Item>
darray<Item>::darray()
{
used = 0;
capacity =1;
data = new Item[1];
}
template <class Item>
darray<Item>::darray(darray<Item>& copy)
{
used = copy.used;
capacity = copy.capacity;
data = new Item[copy.capacity];
}
template <class Item>
darray<Item>::darray(int size)
{
used =0;
capacity = size;
data = new Item[size];
}
Now I have an array of type class, and let's say this class has a derived class called derived_class. Is it possible that my darray<class> can have elements of derived_class?
It uses a push_back function to put items into the array.