Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add example code for article on abstract classes vs traits
  • Loading branch information
CalumMcCall committed Feb 12, 2020
commit 164c764f532dc566c34200dd654b5ef4091b3f6a
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.baeldung.scala.traits.classes

object AbstractClassesAndTraits {

trait Log {
implicit val logTag: String = getClass.getSimpleName
}

abstract class Product(name: String, id: Int) {
def productCode(): String = s"$name:$id"
}

class Chair extends Product("chair", 1)
class vase extends Product("vase", 2)
}