Bonjour je débute avec ajax j'ai pas compris la notion d'héritage suivante
ou est le lien entre BebeOurs et MamanOurs ??
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
18
19
20
21
22
23
24 // class MamanOurs var MamanOurs = function(nom){ this.nom = nom; this.cri = "RAWWWWRR !!!"; }; // Méthode rawr de MamanOurs MamanOurs.prototype.rawr = function(){ alert(this.nom + " crie : " + this.cri); }; // class BebeOurs // notez que pour appeller le constructeur parant, on utilise __proto__.constructor var BebeOurs = function(nom){ this.__proto__.constructor(nom); this.cri = "roooo ..."; }; // voilà l'héritage BebeOurs.prototype = new MamanOurs; // Instanciation var bouba = new BebeOurs("Bouba"); bouba.rawr();
Merci
Source : http://blog.neolao.com/2006/02/07/2-...-en-javascript
Partager