How do you set a variable defined as the base class type to a derived type instance in Scala? -
In Java, I can declare a variable as a base class type, and in a derivative type of example I can set:
Public class MyClass {base foo; Public Null Method () {foo = new derived ()}} I class class class received by MyClass {var foo: Base = _ // Carefully, this is empty unless it starts the DRIT method () = {foo = becomes new}}
Comments
Post a Comment