How do i implement the class smartArray, as a class templateelemtype to accept any numerical value.
How do i implement the class smartArray, as a class templateelemtype to accept any numerical value. Below is code i have issues , in being unable to make theostream and istream work for the template template
class smartArray{
Save your time - order a paper!
Get your paper written from scratch within the tight deadline. Our service is a reliable solution to all your troubles. Place an order on any task and we will take care of it. You won’t have to worry about the quality and deadlines
Order Paper Nowfriend ostream& operator
friend istream& operator>>(istream &, elemType &); // issues with making this work as template
public:
elemType *elements; // dynamic array, memory is allocated inthe
// constructor. Use *this to access size member.
int length(); // returns the length of the array
smartArray(); // default constructor, sets size to 0
smartArray(int size); // constructor, allocates the memory for*elements, if size==0, then no memory allocation is done
~smartArray() ;// destructor
void resize(int newsize) ;
private:
int size;
}; template
ostream& operator
out
for (int i = 0 ; i
out
}
out
return out;
} template
istream& operator>>(istream &in, elemType& b){
for (int i = 0 ; i
{ cout << “Enter element number “<< i << “: “; in>> b.elements[i];}
return in;
} . . .
“Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!”
The post How do i implement the class smartArray, as a class templateelemtype to accept any numerical value. appeared first on Nursing Assignment.