You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In atom A Little Reflection you introduce an object and a trait Name to add a toString to any class. It is unclear to me why the object is needed. This code without an object seems to work equally well:
trait Naam {
override def toString =
currentMirror.reflect(this).symbol.toString.replace('$', ' ').split(' ').last
}
class Noot extends Naam
println((new Noot).toString) // ---> 'Noot'
The text was updated successfully, but these errors were encountered:
In atom A Little Reflection you introduce an object and a trait Name to add a toString to any class. It is unclear to me why the object is needed. This code without an object seems to work equally well:
The text was updated successfully, but these errors were encountered: