2010-04-11 19 views

cevap

11

Bu özel

Cat.prototype = new Mammal();  // Here's where the inheritance occurs 
Cat.prototype.constructor=Cat;  // Otherwise instances of Cat would have a constructor of Mammal 
+3

sayesinde ise bir açıklama http://phrogz.net/JS/Classes/OOPinJS2.html

verir. Javascript gerçekten garip bir dildir. :) – Sake

+2

Oldu. Şahsen, yapıcıyı depolamak için 'constructor 'adını kullanmam çünkü' constructor 'zaten JavaScript’te bir anlamı vardır. (Sadece kullanışlı bir değil.) – bobince