What elements can be stored in an array?

So I've made this dynamic array class. Here are it's constructors:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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.
Last edited on
Is it possible that my darray<class> can have elements of derived_class?
No. But darray<class *> can.
Topic archived. No new replies allowed.