Files
pebble/examples/basic/19_this.peb

19 lines
338 B
Plaintext

class Person {
get_fullname() {
return this.firstname + " " + this.lastname
}
greet(person) {
print("Hello " + person.get_fullname())
}
}
let alice = Person()
alice.firstname = "Alice"
alice.lastname = "Foo"
let bob = Person()
bob.firstname = "Bob"
bob.lastname = "Bar"
alice.greet(bob)
bob.greet(alice)