Implement a template container class that encapsulates a dynamic array and test it using a suitable driver program (You may use one file for your template class instead of breaking it into 2 files.)
Your class should include the following data members:
• A pointer to the array
• A variable to hold the current array capacity (capacity)
• A variable to keep track of the number of elements currently being used.
(num_used)
Include 2 constructors (or you can write one constructor with a default value for size):
• The default constructor dynamically allocates an array of size 10 and initializes capacity to 10 and num_used variable to 0.
• A one argument constructor dynamically allocates an array of the size passed as
an argument and initializes capacity to that number and num_used variable to 0
Include methods to:
• Determine if the array is full (return a bool value)
• Determine if the array is empty (return a bool value)
• Return the array capacity
• Return the number of elements currently being used
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 1 | 2 | 3 | 4 | 5 |