Is there a programming language whose declarations are similar to those used in UML?
-
18-09-2019 - |
Question
Like:
Employee: Person
name: String
id: int
+ employeeCount(): int {
---------------
return employeecount
}
+ name():String {
return name;
}
- secret():void {
///private method
}
Solution
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 and function
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;-).
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow