//collect1.cpp //methods for class Collection implemented using composition #include "collect1.h" //constructor Collection::Collection():elements() {}; //returns true if Collection is empty int Collection::isempty() { return elements.isempty(); } //returns number of elements in the Collection int Collection::size() { int count = 0; Node *p = elements.firstnode(); while(p) { count++; p = p->getnext(); } return count; } //returns true if element belongs to the Collection, otherwise returns false int Collection::includes(Type elt) { return elements.find(elt); } //adds an element to the Collection void Collection::add(Type elt) { if (includes(elt)) return; elements.insertfront(elt); } //prints out elements of the Collection void Collection::print() { elements.print(); }