daily pastebin goal
21%
SHARE
TWEET

Untitled

a guest Dec 13th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top