From ce3f273487c65799dbc8be3ccb649d1c61ac3fbb Mon Sep 17 00:00:00 2001 From: e2hang <2099307493@qq.com> Date: Sat, 19 Jul 2025 21:34:14 +0800 Subject: [PATCH] New --- LinearList/{ => as-Array}/arrayList.cpp | 0 LinearList/{ => as-Array}/arrayList.h | 0 LinearList/{ => as-Array}/linearList.h | 0 LinearList/{ => as-Array}/main.cpp | 0 LinearList/as-List/linearList.h | 20 ++++++++++++++++++++ 5 files changed, 20 insertions(+) rename LinearList/{ => as-Array}/arrayList.cpp (100%) rename LinearList/{ => as-Array}/arrayList.h (100%) rename LinearList/{ => as-Array}/linearList.h (100%) rename LinearList/{ => as-Array}/main.cpp (100%) create mode 100644 LinearList/as-List/linearList.h diff --git a/LinearList/arrayList.cpp b/LinearList/as-Array/arrayList.cpp similarity index 100% rename from LinearList/arrayList.cpp rename to LinearList/as-Array/arrayList.cpp diff --git a/LinearList/arrayList.h b/LinearList/as-Array/arrayList.h similarity index 100% rename from LinearList/arrayList.h rename to LinearList/as-Array/arrayList.h diff --git a/LinearList/linearList.h b/LinearList/as-Array/linearList.h similarity index 100% rename from LinearList/linearList.h rename to LinearList/as-Array/linearList.h diff --git a/LinearList/main.cpp b/LinearList/as-Array/main.cpp similarity index 100% rename from LinearList/main.cpp rename to LinearList/as-Array/main.cpp diff --git a/LinearList/as-List/linearList.h b/LinearList/as-List/linearList.h new file mode 100644 index 0000000..bb4c726 --- /dev/null +++ b/LinearList/as-List/linearList.h @@ -0,0 +1,20 @@ +#ifndef LINEAR_LIST +#define LINEAR_LIST +#include + +template +class linearList { +public: + virtual ~linearList() {}; + virtual bool empty() const = 0; //If empty, return 0; + virtual int size() const = 0; //Return Array Size + virtual T& get(int theIndex) const = 0; // Return Arr[theIndex] + virtual int indexOf(const T& theElement) const = 0; //Return the index of "theElement" first appeared + virtual void erase(int theIndex) = 0; //Erase Arr[theIndex] + virtual T* changeLength(T* x, int oldlength, int newlength) = 0; + virtual void insert(int theIndex, const T& theElement) = 0; //Insert theElement to place Arr[theIndex] + virtual void output() const = 0; //cout +}; + + +#endif \ No newline at end of file