Guest User

Untitled

a guest
Dec 13th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. template <class ItemType>
  2. ArrayBag<ItemType> ArrayBag <ItemType> ::Union(const ArrayBag<ItemType> bag2)
  3. {
  4. ArrayBag<ItemType> unionBag;
  5.  
  6. for (int i = 0; i < getCurrentSize(); i++)
  7. {
  8. unionBag.add(items[i]);
  9. }
  10.  
  11. for (int i = 0; i < bag2.getCurrentSize(); i++)
  12. {
  13. unionBag.add(bag2.items[i]);
  14. if (items[i] == bag2.items[i])
  15. unionBag.remove(bag2.items[i]);
  16. }
  17.  
  18. return unionBag;
  19. }
Add Comment
Please, Sign In to add comment