A LinearList Class
This commit is contained in:
28
LinearList/arrayList.h
Normal file
28
LinearList/arrayList.h
Normal 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
|
||||
|
Reference in New Issue
Block a user