Quick OOP Example

Want some Object Oriented Programming in Clojure? Here’s a quick example.

Let’s create a dog object.

Now let’s use the dog object.

See, OOP in Clojure is fairly simple. This sample uses protocols with records, but you can add polymorphism with just a little extra work. For polymorphism, use records and multimethods.

Leave a Reply

Your email address will not be published. Required fields are marked *