Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <class ItemType>
- ArrayBag<ItemType> ArrayBag <ItemType> ::Union(const ArrayBag<ItemType> bag2)
- {
- ArrayBag<ItemType> unionBag;
- for (int i = 0; i < getCurrentSize(); i++)
- {
- unionBag.add(items[i]);
- }
- for (int i = 0; i < bag2.getCurrentSize(); i++)
- {
- unionBag.add(bag2.items[i]);
- if (items[i] == bag2.items[i])
- unionBag.remove(bag2.items[i]);
- }
- return unionBag;
- }
Add Comment
Please, Sign In to add comment