marqdo

Object inheritanceok

structure/09-inherit.mq.md

文档

Greeter

说明

hello

说明
who=world
+ who
`msg` = "Hello, `who`!"
`msg`

Loud

说明

hello

说明
who=world
+ who
`msg` = "HELLO, `who`!"
`msg`

main

说明
`g` = > Greeter
`m` = > `g`.hello who="world"
> print text=m
`l` = > Loud
`m2` = > `l`.hello who="world"
> print text=m2
Functions
Variables
  • description text
    # Child = > Parent; methods walk the base chain
  • g Greeter
    _typeGreeter
  • l Loud
    _typeLoud
  • m text
    Hello, world!
  • m2 text
    HELLO, world!
  • markup text
    occlusion
  • title text
    Object inheritance
可执行知识(辅助)

Greeter.hello function

Target
mq://public/structure%2F09-inherit/function/Greeter/hello
Signature
(who: any) → any
Effects
pure
Verification
parse: passed; resolve: passed; contract: unchecked; tests: unknown; evidence: unverified(尚无来源记录)
制品摘要
sha256:10d9ec9ff2e13… (未检查锁定状态)
Depends on
none
Execution
尚无该知识的运行记录(知识预览不执行)。

Loud.hello function

Target
mq://public/structure%2F09-inherit/function/Loud/hello
Signature
(who: any) → any
Effects
pure
Verification
parse: passed; resolve: passed; contract: unchecked; tests: unknown; evidence: unverified(尚无来源记录)
制品摘要
sha256:5e53f1d1e076d… (未检查锁定状态)
Depends on
none
Execution
尚无该知识的运行记录(知识预览不执行)。

运行与结果

Hello, world! HELLO, world!
完整源码
---
markup: occlusion
title: Object inheritance
description: "# Child = > Parent; methods walk the base chain"
---

# Greeter

## hello
    + `who`

**`msg` = "Hello, `who`!"**
*`msg`*

# Loud = > Greeter

## hello
    + `who`

**`msg` = "HELLO, `who`!"**
*`msg`*

# main

**`g` = > Greeter**
**`m` = > `g`.hello who="world"**
> print text=`m`
**`l` = > Loud**
**`m2` = > `l`.hello who="world"**
> print text=`m2`

Variable