Add member functions setUnion(), setIntersection(), and setDifference().
(Don't add them to the SetInterface class.)
Operations on sets are fundamental mathematical concepts. If you haven't studied them already, you will if you take a Discrete Math course. I will tell you everything you need to know here, in case you have not studied them.
Union: The union of two Sets is a new Set containing the combined contents of the original two Sets. Of course, since Sets can never contain duplicate items, if both of the two Sets contain a particular item, that item will only occur once in the new Set.
Intersection: The intersection of two Sets is a new Set containing the entries that occur in both of the original two Sets.
Difference: The difference of two Sets is a new Set containing the entries that would be left in the first Set after removing those that also occur in the second.
An example of difference: if Set A contains 2, 3, 4, 5 and set B contains 4, 5, 6, 7, then the difference of A and B would be a new Set containing only 2 and 3.
The functions should all have one ArraySet parameter and should perform the operation using the ArraySet calling object as the first operand and the ArraySet parameter as the second operand. It should return the resulting ArraySet. The resulting ArraySet must have a capacity of DEFAULT_CAPACITY. The setUnion() function should throw a CapacityExceededError if the size of the result exceeds the capacity of the ArraySet). Here's a snippet of client code:
try {
set1 = set2.setUnion(set3);
} catch (CapacityExceededError e) {
cout << "Operation exceeds the capacity of sets and therefore failed." << endl;
}
Don't call the toVector() function from any of these three functions.
For documentation, you must provide function documentation for any new functions that you are writing (setUnion(), setIntersection(), setDifference()). No other documentation is required.