Skip to content

Instantly share code, notes, and snippets.

@zhhailon
Created May 13, 2022 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhhailon/ec62d115bb1cb5b0c299ac489821ac2e to your computer and use it in GitHub Desktop.
Save zhhailon/ec62d115bb1cb5b0c299ac489821ac2e to your computer and use it in GitHub Desktop.
/** List abstract class. */
template <typename ItemType> class List {
public:
virtual int size() const = 0;
virtual ItemType &get(int i) = 0;
virtual const ItemType &get(int i) const = 0;
virtual void insert(const ItemType &x, int i) = 0;
virtual ItemType remove(int i) = 0;
virtual void addFirst(const ItemType &x) = 0;
virtual void addLast(const ItemType &x) = 0;
virtual ItemType &getFirst() = 0;
virtual ItemType &getLast() = 0;
virtual const ItemType &getFirst() const = 0;
virtual const ItemType &getLast() const = 0;
virtual ItemType removeFirst() = 0;
virtual ItemType removeLast() = 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment