I am designing a class and some methods are designed to be overriden in subclasses. Which of these ways is better or what are pros and cons?
Way 1:
class Foo(foo: (Int) => Unit = _=>{})
Way 2:
class Bar {
def bar(int: Int) = {}
}
I understand that foo
is a function value and bar
is a method (so foo
cannot define default values for parameters) and Bar
could be a trait (unlike Foo
), but is there more?