I’m learning Scala and there is a thing that I can’t find out about the language:
Some time ago I was very comfortable programming in Lisaac, and in Lisaac I could write a class PERSON with a slot list:ARRAY[SELF], which was equivalent to have list:ARRAY[PERSON], since SELF is the type of the object where that slot is.
But by using SELF, if I write a second class STUDENT that inherits from PERSON, then STUDENT would inherit that slot changing SELF for STUDENT, so STUDENT would have a list of STUDENT instead of PERSON.
Can that be done in Scala? I can´t find out anything about that.
Thanks!
I’m not sure if this will actually be useful to you, but the closest thing I can think of is
this.type. E.g: