February 2018
Intermediate to advanced
552 pages
13h 46m
English
We can define a Trait only with abstract members, as shown here:
rambabuposa@ram$ scala -cp joda-time-2.9.6.jar
Welcome to Scala 2.12.3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_121).Type in expressions for evaluation. Or try :help.scala> case class Weather(day: String, temparature: String) defined class Weather scala> :paste // Entering paste mode (ctrl-D to finish) import org.joda.time.LocalDate trait IWeatherForecasting { def getWeatherForecasting(date:LocalDate) : Weather } // Exiting paste mode, now interpreting. import org.joda.time.LocalDate defined trait IWeatherForecasting
Here, joda-time-2.9.6.jar should be available in the current working directory.
Now, we can extend this Trait using a class, ...
Read now
Unlock full access