Skip to content

Instantly share code, notes, and snippets.

@yossale
Created April 20, 2011 20:42
Show Gist options
  • Save yossale/932791 to your computer and use it in GitHub Desktop.
Save yossale/932791 to your computer and use it in GitHub Desktop.
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