Bonjour,

j'ai le code suivant :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
var Buildings = Class.create({
	buildings : [],
 
	register : function(building) {
		if(typeof building  == "Building") {
			this.buildings.push(building);
		}
	}
});
 
var Building = Class.create({
	initialize : function(name) {
		this._name = name;
 
		Buildings.register(this);
	}
});
Seulement ce code me renvoie l'erreur :

Uncaught TypeError: Object function klass() {
this.initialize.apply(this, arguments);
} has no method 'register'
Il ne trouve donc pas la méthode register de Buildings... Qu'ai-je fais de mal?