title: How to get the runtime class of a generic type in Scala?
body: <pre><code>import scala.reflect.runtime.universe._
  import scala.reflect.ClassTag
  import scala.reflect.classTag
  
  def getTypeTag[T: TypeTag](obj: T) = println(typeTag[T].tpe)
  
  class Entity
  {
      def greet = println("Hello!")
  }
  
  class Point[T : TypeTag](val x : T, val y :T) extends Entity
  
  val p = new Point[Int](2,5)
  val p2 = new Point[Float](1.0f,-5.0f)
  val p3 = new Point[Double](4.0,-7.0)
  
  val path = Array[Entity](p,p2,p3)
  
  path.foreach(getTypeTag(_))
  </code></pre>
  
  <p>This small code snippet writes to stdout</p>
  
  <pre><code>Helper.this.Entity
  Helper.this.Entity
  Helper.this.Entity
  </code></pre>
  
  <p>I'd like it to write</p>
  
  <pre><code>Helper.this.Point[Int]
  Helper.this.Point[Float]
  Helper.this.Point[Double]
  </code></pre>
  
  <p>I know there are already a lot of question about scala reflection, I read many of them but still haven't understand the difference between TypeTag, Manifest and ClassTag; nor I can get this very basic example to work. Any help would be greatly appreciated.</p>
  
  <p>Thanks in advance</p>