title: Implicit conversions in scala
body: <p>Does Scala have implicit conversions for objects? For example, if I have a method with the following signature:</p>
  
  <pre><code>object Foo {
    def print(message: String) = println(message)
  }
  
  class Bar {
      val baz = 1
  }
  </code></pre>
  
  <p>How can I call <code>Foo.print(new Bar)</code>?</p>
  
  <p>Can I put a method on the <code>Bar</code> class to implicitly convert <code>Bar</code> instance to a string without having to call <code>toString</code> in the argument? </p>
  
  <p>C# has this and I'm wondering if scala does too.</p>
  
  <p>Let's say we have Scala enum:</p>
  
  <pre><code>object Color extends Enumeration {
  
    type Method = Value
  
    val RED, BLUE, GREEN = Value
  
   }
  </code></pre>
  
  <p>Then I have a class:</p>
  
  <pre><code>object ColorPrinter {
    def print(x: String) = {
      println(x)
    }
  }
  </code></pre>
  
  <p>ColorPrinter's print method can't be changed.</p>
  
  <p>I want to call into <code>ColorPrinter.print(Color.RED)</code>, but I can't do that. I would have to call it like this: <code>ColorPrinter.print(Color.RED.toString)</code>.</p>
  
  <p>I want to avoid having to <code>toString</code></p>