Files
2026-02-06 23:04:00 +01:00

20 lines
379 B
Plaintext

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