title: Scala - object extends abstract class and takes parameters
body: <blockquote>
    <p>//File Animal.scala</p>
  </blockquote>
  
  <pre><code>abstract class Animal {
  
      val name: String
  
      def getSomething(tClass: TypeClass): String = {
          tClass.tName.split('.').lift(0)
      }
  
      def apply(tClass: TypeClass): SomeOtherClassType = {
          // something... 
  
      }
  </code></pre>
  
  <blockquote>
    <p>// File: <em>DogSpike</em>, this is used for some specific cases (overwrites
    base class val)</p>
  </blockquote>
  
  <pre><code>object DogSpike extends Animal {
  
    override val name: String = "Spike"
  }
  </code></pre>
  
  <p><em>this call then works (calls apply)</em><br>
   <code>myTransformation(() =&gt; DogSpike(this))</code></p>
  
  <p>Now I would like to create a more generic object that one can pass arguments but I am unable to.</p>
  
  <p>It would work to create a derived Object from Animal that takes one arguments and being able to use the apply call</p>
  
  <pre><code>object TheDog(name: String) extends Animal {
  
    override val name: String = "Spike"
  //...
  }
  </code></pre>
  
  <p><em>not sure how to implicitly call Animal.apply for <code>TheDog</code> object where I could pass a parameter (name)</em><br>
   <code>myTransformation(() =&gt; TheDog(this))</code></p>
  
  <pre><code>// also this seems to be incorrect "*Wrong top statement declaration*"
  object TheDog(val n: String) extends Animal {
     override val name: String = n
  //...
  }
  </code></pre>