เติมเต็ม
Translation status: ภาษาไทย reader-locale proof. Term names and code fences follow the th-TH pack; supporting prose may still be English.
Declares that a type implements one or more สัญญา contracts.
Aliases: implements
Syntax: ชนิด <name> เติมเต็ม <interface-list> <block>
Category#
type
Related#
Examples#
radix/corpus/implet/implet.fab (canonical · keyword)#
Declares that a type implements one or more สัญญา contracts.
# =============================================================================
# เติมเต็ม — Declares that a type implements one or more สัญญา contracts
# =============================================================================
#
# What this teaches:
# • Declares that a type implements one or more สัญญา contracts.
# • Related keywords: ชนิด, สัญญา
#
# Common mistakes:
# • Declaring `ชนิด เติมเต็ม Implendum` without implementing all required methods — every method signature in the สัญญา must have a body in the ชนิด.
#
# See also: ชนิด, สัญญา
# =============================================================================
# เติมเต็ม — ชนิด implements a สัญญา (interface contract)
#
# ชนิด Nomen เติมเต็ม Implendum { … }
#
# GRAMMAR:
# genusDecl :← 'ชนิด' ident 'เติมเต็ม' ident '{' methodDecl* '}'
#
# EXPECTED OUTPUT:
# implet.expected — Aurelia from สัญญา plenum().
interface Nominatum {
fn plenum() → string
}
class Civis implements Nominatum {
var string ชื่อ
fn plenum() → string {
# satisfies สัญญา requirement
return "§"(self.nomen)
}
}
main {
const Civis civis ← Civis { ชื่อ = "Aurelia" }
print civis.plenum()
}Expected output:
Aurelia