Initializing Generic Variables in Scala -


How can I declare a generic variable in Scale (or to start any value) without initializing it Am I

def foo [T] {var t: T = ???? // try _, null t}
  def foo [T] {var t: T = Null.asInstanceOf [T] t}  

And, if you do not like the function involved, you can reduce it in this way:

 < Code> // Import your scope into case class init (): Init deaf Init Tot [T] (I: Init): T = {null.asInstanceOf [T]} // Then DefF [T] {Var t: T = Init () t}  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -