Mark Sibly 8 vuotta sitten
vanhempi
commit
643a072fb9
1 muutettua tiedostoa jossa 23 lisäystä ja 2 poistoa
  1. 23 2
      modules/monkey/docs/language/functions.md

+ 23 - 2
modules/monkey/docs/language/functions.md

@@ -5,7 +5,7 @@
 
 To declare a global function:
 
-`Function` _Identifier_ [ `:` _ReturnType_ ] `(` _Arguments_ `)`
+`Function` _Identifier_ [ _GenericParams_ ] [ `:` _ReturnType_ ] `(` _Parameters_ `)`
 ```
 	...Statements...
 ```
@@ -13,7 +13,28 @@ To declare a global function:
 
 _ReturnType_ defaults to `Void` if omitted.
 
-_Arguments_ is a comma separated list of parameter declarations.
+_Parameters_ is a comma separated list of parameter declarations.
+
+
+#### Class methods
+
+The syntax for declaring a class method is:
+
+`Method` _Identifier_ [ _GenericParams_ ] [ `:` _ReturnType_ ] `(` _Parameters_ `)` [ `Virtual`|`Abstract|`Override``|`Final`|`Override Final` ]
+```
+	...Statements...
+```
+`End`
+
+If a method is declared `Virtual` or `Abstract`, it can be overriden by methods in derived classes. Overriding methods must have the same return type and parameter types as the class method, and must be declared `Override`.
+
+If a method is declared `Abstract`, no implementation may be provided (ie: no 'statements' or 'End'). Such a method must be overriden by a method in a derived class, and also makes its enclosing class implictly abstract (an abstract class cannot be instantiated).
+
+If a method is declared `Override` or `Override Final`, it must override a virtual method in a base class.
+
+If a method is declared `Final` or `Override Final`, it cannot be overriden by any methods in derived classes.
+
+By default, class methods are final.
 
 
 #### Lambda functions