Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Fish class that access other fish inner field
class Fish (var fishName: String){
private var myName = fishName
def name = myName
def name_= (newName: String) = myName = newName
def sayHello(otherFish : Fish) = println ("hello, " + otherFish.myName)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment