Bag.st
changeset 11 6bf3080856be
parent 5 67342904af11
child 54 06dbdeeed4f9
--- a/Bag.st	Mon Nov 08 03:32:43 1993 +0100
+++ b/Bag.st	Sat Dec 11 01:42:02 1993 +0100
@@ -31,7 +31,7 @@
 
 contents        <Dictionary>        for each element, the number of occurrences
 
-$Header: /cvs/stx/stx/libbasic/Bag.st,v 1.4 1993-10-13 02:11:00 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Bag.st,v 1.5 1993-12-11 00:41:17 claus Exp $
 written jun 91 by claus
 '!
 
@@ -101,6 +101,18 @@
     ^ contents includesKey:anObject
 ! !
 
+!Bag methodsFor:'converting'!
+
+asBag
+    "return the receiver as a bag"
+
+    "could be an instance of a subclass..."
+    self class == Bag ifTrue:[
+        ^ self
+    ].
+    ^ super asBag
+! !
+
 !Bag methodsFor:'adding & removing'!
 
 add:anObject