home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl
- require 'set.pl';
-
- $set1 = &newobject('set'); # Elements can't duplicate in set class
- $bag1 = &newobject('bag'); # Elements can duplicate in bag class
-
- print "** set **\n";
- &send($set1, 'put', 'banana');
- &send($set1, 'put', 'apple');
- &send($set1, 'put', 'orange');
- &send($set1, 'put', 'orange');
- &send($set1, 'put', 'orange');
-
- print "Orange Total=" . &send($set1, 'how_many', 'orange') . "\n";
- &send($set1, 'dump');
- &send($set1, 'show_self');
-
- &send($set1, 'delete', 'orange');
-
- print "Orange Total=" . &send($set1, 'how_many', 'orange') . "\n";
- &send($set1, 'dump');
- &send($set1, 'show_self');
-
- print "** bag **\n";
- &send($bag1, 'put', 'banana');
- &send($bag1, 'put', 'apple');
- &send($bag1, 'put', 'orange');
- &send($bag1, 'put', 'orange');
- &send($bag1, 'put', 'orange');
-
- print "Orange Total=" . &send($bag1, 'how_many', 'orange') . "\n";
- &send($bag1, 'dump');
- &send($bag1, 'show_self');
-
- &send($bag1, 'delete', 'orange');
-
- print "Orange Total=" . &send($bag1, 'how_many', 'orange') . "\n";
- &send($bag1, 'dump');
- &send($bag1, 'show_self');
-