# receveur ("self")
# Les attributs sont déclarés par le mot clé "fun" et commencent par un "@"
- var nom_: String # Un entrepôt a un nom (de type chaîne).
- var rayons: Array[Rayon] # Il est composé d'un ensemble de rayon.
+ var nom_: String is noinit # Un entrepôt a un nom (de type chaîne).
+ var rayons: Array[Rayon] is noinit # Il est composé d'un ensemble de rayon.
# "Array" est une classe paramétrée, les crochets en sont la marque.
# La classe "Rayon" est définie plus loin
class Point
private
- var x: Int # Abscisse
- var y: Int # Ordonnée
+ var x: Int = 0 # Abscisse
+ var y: Int = 0 # Ordonnée
# Change la position d'un point
fun moveto(x: Int, y: Int)
end
- init
- do
- moveto(0, 0)
- end
-
init at(x: Int, y: Int)
do
moveto(x, y)
-alt/base_init_combine_alt1.nit:52,6: Error: base_init_combine_alt1#F cannot inherit constructors from E because there is attributes without initial values: z: Int
+1
+2
+2
+3
+2
+2
+5
+2
+6
-alt/error_init_auto_alt4.nit:35,5--12: Error: Incorrect number of parameters. Got 1, expected 0. Signature is
-alt/error_init_auto_alt4.nit:36,5--15: Error: Incorrect number of parameters. Got 2, expected 0. Signature is
-alt/error_init_auto_alt4.nit:37,5--18: Error: Incorrect number of parameters. Got 3, expected 0. Signature is
+alt/error_init_auto_alt4.nit:34,5--9: Error: Incorrect number of parameters. Got 0, expected 1. Signature is (x: Int)
+alt/error_init_auto_alt4.nit:36,5--15: Error: Incorrect number of parameters. Got 2, expected 1. Signature is (x: Int)
+alt/error_init_auto_alt4.nit:37,5--18: Error: Incorrect number of parameters. Got 3, expected 1. Signature is (x: Int)
end
class Toto
- var a: Int
+ var a: Int is noinit
redef fun output
do
printn(_a)
# limitations under the License.
class A
- var attribute: nullable A
- var num: Char
+ var attribute: nullable A is noinit
+ var num: Char is noinit
fun foo=(a: nullable A)
do