是否有一种编程语言的声明与 UML 中使用的声明类似?
喜欢:
Employee: Person
name: String
id: int
+ employeeCount(): int {
---------------
return employeecount
}
+ name():String {
return name;
}
- secret():void {
///private method
}
Like:
Employee: Person
name: String
id: int
+ employeeCount(): int {
---------------
return employeecount
}
+ name():String {
return name;
}
- secret():void {
///private method
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Objective C 使用
+
作为类方法,使用-
作为实例方法——非常不同的解释,但它是我所知道的唯一用这样的加号和减号来修饰方法的语言; -)。在 C 占领世界之前,“名称:类型”表示法(通常用主要关键字来丰富,例如变量的
var
和函数的function
)非常流行,最值得注意的是也许是 Pascal(一种现在有点晦涩的语言,不久前它自己也曾有过统治世界的可信努力;-)。Objective C uses
+
for class methods and-
for instance methods -- very different interpretation, but it's the only language I know that decorates methods with plus and minus signs like that;-).The "name: type" notation (often enriched with a leading keyword such as
var
for variables andfunction
for functions) was quite popular before C took over the world, most notably perhaps in Pascal (a now-somewhat-obscure language that had a credible bid of its own for world domination not all that long ago;-).