added lesson 7
This commit is contained in:
16
src/Lesson7/LoggingFactory.sc
Normal file
16
src/Lesson7/LoggingFactory.sc
Normal file
@@ -0,0 +1,16 @@
|
||||
trait Logged {
|
||||
def log(msg: String)
|
||||
}
|
||||
|
||||
trait ConsoleLogger extends Logged {
|
||||
override def log(msg: String) = println("[LOG] " + msg)
|
||||
}
|
||||
|
||||
abstract class Person(name: String)
|
||||
|
||||
class Customer(n: String) extends Person(n) with Logged {
|
||||
log(s"Person $n created")
|
||||
}
|
||||
|
||||
val a = new Customer("Patrick Jane") with ConsoleLogger
|
||||
|
||||
Reference in New Issue
Block a user