Skip to content

第一章中函数声明中列举的例子 #222

Open
@qpc2015

Description

@qpc2015

typedef bool CALLBACK();

//不指定返回类型,此时默认为dynamic,不是bool
isNoble(int atomicNumber) {
return _nobleGases[atomicNumber] != null;
}

void test(CALLBACK cb){
print(cb());
}
//报错,isNoble不是bool类型
test(isNoble);

isNoble同时也不满住typedef定义的无参数

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions