OK I finally got around this the following way.
Account.scala (now has a "def" not a "val")
UpgradedAccount.scala
Then I ran into trouble mixing this in. This version Member with the definition "class Member(val accountType: Int) extends Account" caused UpgradedMember to be unable to compile.
Member.scala (BAD version - compiles, but creates trouble later on...)
UpgradedMember.scala
Attempt to compile UpgradedMember.scala against Member.scala as defined above led to:
Then I changed to this version.
Member.scala (GOOD version)
In my real-world scenario,
Java needs to call these...so I wrote this quick little program as a
test of this to demonstrate the concept.
TestMemberUpgrades.java
This gives the output:
Stan has an account of type 0.
Upgraded Stan has an account of type 2.