#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Thu, 15 Jun 2017 13:56:59 +0200
changeset 21817 5d251e1af13a
parent 21816 3db3da9b3702
child 21818 20bc6feedae5
#FEATURE by cg class: Complex class added: #coerce:
Complex.st
--- a/Complex.st	Thu Jun 15 13:56:41 2017 +0200
+++ b/Complex.st	Thu Jun 15 13:56:59 2017 +0200
@@ -161,6 +161,14 @@
     "Modified (comment): / 12-06-2017 / 20:44:32 / cg"
 ! !
 
+!Complex class methodsFor:'coercing'!
+
+coerce: aNumber
+    "convert the argument aNumber into an instance of the receiver's class and return it."
+
+    ^ aNumber asComplex
+! !
+
 !Complex class methodsFor:'constants access'!
 
 unity