Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
18
Task/Polymorphism/Clojure/polymorphism.clj
Normal file
18
Task/Polymorphism/Clojure/polymorphism.clj
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
(defprotocol Printable
|
||||
(print-it [this] "Prints out the Printable."))
|
||||
|
||||
(deftype Point [x y]
|
||||
Printable
|
||||
(print-it [this] (println (str "Point: " x " " y))))
|
||||
|
||||
(defn create-point
|
||||
"Redundant constructor function."
|
||||
[x y] (Point. x y))
|
||||
|
||||
(deftype Circle [x y r]
|
||||
Printable
|
||||
(print-it [this] (println (str "Circle: " x " " y " " r))))
|
||||
|
||||
(defn create-circle
|
||||
"Redundant consturctor function."
|
||||
[x y r] (Circle. x y r))
|
||||
Loading…
Add table
Add a link
Reference in a new issue