title: Invoke a case class from a main method within an object
body: <p>In this below class : </p>
  
  <pre><code>package patternmatching
  
  abstract class Expr {
  
    case class Var(name: String) extends Expr
    case class Number(num: Double) extends Expr
    case class UnOp(operator: String, arg:Expr) extends Expr
    case class BinOp(operator: String, left: Expr, right: Expr) extends Expr
  
  
  }
  </code></pre>
  
  <p>I define the main class as : </p>
  
  <pre><code>package patternmatching
  import patternmatching.Expr.Var
  
  object PatternMain {
  
        def main(args:Array[String]) {
  
           val v = Var("x")
      }
  
  }
  </code></pre>
  
  <p>But I receive a compile time error in PatternMain at line <code>import patternmatching.Expr.Var</code> :</p>
  
  <blockquote>
    <ul>
    <li>object Expr is not a member of package patternmatching Note: class Expr exists, but it has no      companion object.</li>
    </ul>
  </blockquote>
  
  <p>How do I correctly invoke <code>val v = Var("x")</code> against the case class Var ? Am I not importing it correctly ?</p>