using C++. In this problem, you will be implementing an Array class, with some a
ID: 3821867 • Letter: U
Question
using C++.
In this problem, you will be implementing an Array class, with some additional features, such as dynamic memory allocation and defining the copy constructor and the assignment operator. (a) The class must have the following data members: • An int for the array size. • A pointer to an int for the array elements. (b) Memory management should be done dynamically using the appropriate new operator in the constructor and the delete operator in the destructor. (c) The class must also define the following: • A constructor • A copy constructor • Assignment operator • Addition operator • A method to sort the array • A method to display the array elements
Explanation / Answer
const int size =10;
class array
{
int a [size];
int *ptr [size];
void sort()
{
]
~array ()
{
delete []ptr;
}
void display()
{
}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.