Page 1 of 1

Given the following Array class, how should we implement the destructor so that it causes no errors and avoids memory le

Posted: Fri Apr 29, 2022 8:04 am
by answerhappygod
Given The Following Array Class How Should We Implement The Destructor So That It Causes No Errors And Avoids Memory Le 1
Given The Following Array Class How Should We Implement The Destructor So That It Causes No Errors And Avoids Memory Le 1 (56.13 KiB) Viewed 20 times
Given The Following Array Class How Should We Implement The Destructor So That It Causes No Errors And Avoids Memory Le 2
Given The Following Array Class How Should We Implement The Destructor So That It Causes No Errors And Avoids Memory Le 2 (29.97 KiB) Viewed 20 times
Given the following Array class, how should we implement the destructor so that it causes no errors and avoids memory leaks? include <string> #define MAX 256 using namespace std; class Student { public: Student (const string& n = "00000000",const string& s = "Hey you!"); private: string number; string name; Elass Array { public: Array():size(e){elements = new Student[MAX];} --Array(); void add(const string& name, const string& num); int get(int index); int getSize(); private: int size; Students elements;
O Array ( [ delete [] elements; O Array(){ for (int i = 0; i < MAX; ++i){ delete elements; } delete [] elements; Array(0) Array ( [ for (int i = 0; i < size; ++i) { delete elements[1]; } delete [] elements; O None of these