Question: I am tasked with making a resizeable array with constructors and using and a template class. I am not familiar with this stuff, hence i

I am tasked with making a resizeable array with constructors and using and a template class. I am not familiar with this stuff, hence i turn to here for help. Below is what I am tasked with. Some guidance on this subject would be much appreciated. Program is in C++:

Code Below (Need to Fill):

#ifndef DARRAY_H

#define DARRAY_H 
 
#include  
 
template 
class DArray 
{ 
public: 
/*int length; 
 int *pa; 
 int nextIndexl; 
 */ 
 
 
 DArray:: Darray() 
 {/*implementation cosntructor*/ 
 
 
 
 }; 
 DArray( size_t count ) 
 {/*implementation 
 overloaded constructor (dynamically allocate the array with size of count*/ 
 
 
 } 
 DArray( std::initializer_list initList ) 
 {/*implementation 
 takes in a list and you want to dynamically allocate the arraty from the list*/}; 
 DArray( const DArray& other) 
 {/*implementation 
 getting the reference from another array*/}; 
 DArray& operator=(const DArray &other) 
 {/*implementation 
 overloaded operator (allows to use the assignment operator to declare another array)*/ 
 DArray instance1; 
 return instance1; 
 }; 
 ~DArray(); 
 
 T& at( size_t pos ) 
 {/*implementation*/}; 
 const T& at( size_t pos ) const 
 {/*implementation*/}; 
 T& front() 
 {/*implementation*/}; 
 const T& front() const 
 {/*implementation*/}; 
 T& back() 
 {/*implementation*/}; 
 const T& back() const 
 {/*implementation*/}; 
 void clear() 
 {/*implementation*/}; 
 void pop_back() 
 {/*implementation*/}; 
 void push_back( const T& ) 
 {/*implementation*/}; 
 void resize( size_t count ) 
 {/*implementation*/}; 
 bool empty() const 
 {/*implementation*/}; 
 size_t size() const 
 {/*implementation*/}; 
 void reserve( size_t new_cap ) 
 {/*implementation*/}; 
 size_t capacity() const 
 {/*implementation*/}; 
 
 T& operator[]( size_t pos ); 
 const T& operator[]( size_t pos ) const; 
}; 
 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!