added funciton declaration

This commit is contained in:
Andrew Segavac
2021-07-17 15:40:22 -06:00
parent 290646b8e2
commit 691009dd59
4 changed files with 50 additions and 43 deletions

View File

@@ -64,3 +64,20 @@ impl User {
return self.id;
}
}
type TestTrait trait {
fn classMethod(id: I64): Self;
fn instanceMethod(self: Self): I64;
fn defaultImpl(self: Self): I64 {
return self.instanceMethod;
}
}
impl TestTrait for User {
fn classMethod(id: I64): Self {
return User{id: id,};
}
fn instanceMethod(self: Self): I64 {
return self.get_id();
}
}