aboutsummaryrefslogtreecommitdiff
path: root/examples/43-generic-struct-methods-this/src/HelloWorld.shed
blob: b114d85a2947cfbc78279a38262687ea4962b7c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
pub fun main() ! Io -> Unit {
    val messageBox = Box("hello, world");

    print!(messageBox.me().get());
}

struct Box[T](value: T) {
    fun me(this) -> Box[T] {
        this
    }

    fun get(this) -> T {
        this.value
    }
}