Files
BasicsOfComputerSoftwareEng…/OOP/12/Optional01/setE.h
2023-05-19 20:15:17 +08:00

22 lines
447 B
C++

#pragma once
#include "ListExceptions.h"
#include "listE.h"
template <class E> class Set : public List<E> {
public:
List<E> &append(const E &_newItem) {
if (this->contains(_newItem)) {
throw(DuplicateError());
}
List<E>::append(_newItem);
return *this;
}
List<E> &insert(int index, const E &_newItem) = delete;
E pop(int index) = delete;
int index(const E &target) = delete;
};