Question: why does my program has this error.what should I do? and here is my code of the .h file. #ifndef DYNAMICARRAY_H #define DYNAMICARRAY_H template class

why does my program has this error.what should I do?why does my program has this error.what should I do? and here

and here is my code of the .h file.

#ifndef DYNAMICARRAY_H #define DYNAMICARRAY_H

template class DynamicArray { private: A* a; int C; A dummy; public: DynamicArray(int=2); //constructor

DynamicArray(const DynamicArray&);//copy cons DynamicArray& operator=(const DynamicArray&);//assign operator int capacity()const{return C;} void capacity(int);//setter prototype A operator[](int )const ;//getter A& operator[](int);//setter ~DynamicArray(){delete []a;} }; template A& DynamicArray::operator[](int b) { if(b=C) capacity(2*b); return a[b]; } template A DynamicArray::operator[](int b)const { if(b=C) return dummy; return a[b]; } template DynamicArray::DynamicArray(const DynamicArray& original) { C =original.C; a= new A[C]; for(int i=0;i DynamicArray&DynamicArray::operator=(const DynamicArray& original) { if(this != &original) { delete [] a; C=original.C; a= new A[C]; for(int i=0;i void DynamicArray::capacity(int C) { A* temp=new A[C]; int limit;//= min(C,this->C); for(int i=0;iC=C; };

#endif

#include kiostream #include cassert include Kalgorithm include "DynamicArray.h" using namespace std; int main Dynamic Array int k cout

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!