thực_thi
Translation status: Tiếng Việt reader-locale proof. Term names and code fences follow the vi pack; supporting prose may still be English.
Declares that a type implements one or more giao_ước contracts.
Aliases: implements
Syntax: kiểu <name> thực_thi <interface-list> <block>
Category#
type
Related#
Examples#
radix/corpus/implet/implet.fab (canonical · keyword)#
Declares that a type implements one or more giao_ước contracts.
# =============================================================================
# thực_thi — Declares that a type implements one or more giao_ước contracts
# =============================================================================
#
# What this teaches:
# • Declares that a type implements one or more giao_ước contracts.
# • Related keywords: kiểu, giao_ước
#
# Common mistakes:
# • Declaring `kiểu thực_thi Implendum` without implementing all required methods — every method signature in the giao_ước must have a body in the kiểu.
#
# See also: kiểu, giao_ước
# =============================================================================
# thực_thi — kiểu implements a giao_ước (interface contract)
#
# kiểu Nomen thực_thi Implendum { … }
#
# GRAMMAR:
# genusDecl :← 'kiểu' ident 'thực_thi' ident '{' methodDecl* '}'
#
# EXPECTED OUTPUT:
# implet.expected — Aurelia from giao_ước plenum().
interface Nominatum {
fn plenum() → string
}
class Civis implements Nominatum {
var string tên
fn plenum() → string {
# satisfies giao_ước requirement
return "§"(self.nomen)
}
}
main {
const Civis civis ← Civis { tên = "Aurelia" }
print civis.plenum()
}Expected output:
Aurelia