Skip to content

Instantly share code, notes, and snippets.

@mkovacek
Created October 18, 2016 09:19
Show Gist options
  • Save mkovacek/285c329f0955390ba43f7a69ec391fe9 to your computer and use it in GitHub Desktop.
Save mkovacek/285c329f0955390ba43f7a69ec391fe9 to your computer and use it in GitHub Desktop.
class Person(val firstName: String, val lastName: String){
println("beginning of the constructor")
var age = 25
def printInfo = println("Firstname: " + firstName + ", lastname: " + lastName + ", age: " + age)
printInfo
println("end of the constructor")
}
val person = new Person("Matija","Kovacek")
/*
beginning of the constructor
Firstname: Matija, lastname: Kovacek, age: 25
end of the constructor
*/
// getter
person.firstName
//setter
person.age = 30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment