This commit is contained in:
e2hang
2025-07-30 14:33:09 +08:00
parent c77f685f1f
commit ecb484a9e8
36 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
#ifndef ARRAY_LIST
#define ARRAY_LIST
#include <iostream>
#include "linearList.h"
template <typename T>
class arrayList : public linearList<T> {
public:
arrayList(int initialCapacity = 10);
arrayList(const arrayList<T>& x);
~arrayList();
int capacity();
bool empty() const;//If empty, return 0;
int size() const; //Return Array Size
virtual T& get(int theIndex) const override; // Return Arr[theIndex]
virtual int indexOf(const T& theElement) const override; //Return the index of "theElement" first appeared
virtual void erase(int theIndex) override; //Erase Arr[theIndex]
virtual T* changeLength(T* x, int oldlength, int newlength) override;
virtual void insert(int theIndex, const T& theElement) override; //Insert theElement to place Arr[theIndex]
virtual void output() const override; //cout
private:
T* element;
int arrayLength;
int listSize;
};
#endif