From 279931cd0bf387f7a9315b7db50e30a60275b26b Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Mon, 7 May 2012 00:08:59 -0400 Subject: [PATCH] Augmented Classical Interitance section of About page with isA() information --- index.html | 13 ++++++++++++- scripts/ex/class-poly.js | 7 +++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 scripts/ex/class-poly.js diff --git a/index.html b/index.html index 24b8781..99cb133 100644 --- a/index.html +++ b/index.html @@ -92,7 +92,18 @@

- To prevent a class from being extended, FinalClass can be used. + Type checks for polymorphic methods may be performed with + Class.isA(), which is recommended in + place of instanceof. +

+
+  
+
+ +

+ To prevent a class from being extended, FinalClass may be used.

   
diff --git a/scripts/ex/class-poly.js b/scripts/ex/class-poly.js
new file mode 100644
index 0000000..c5b32cb
--- /dev/null
+++ b/scripts/ex/class-poly.js
@@ -0,0 +1,7 @@
+var cow    = Cow(),
+    sturdy = SturdyCow();
+
+Class.isA( Cow, cow );           // true
+Class.isA( SturdyCow, cow );     // false
+Class.isA( Cow, sturdy );        // true
+Class.isA( SturdyCow, sturdy );  // true