1
0
Fork 0

Augmented Classical Interitance section of About page with isA() information

website
Mike Gerwitz 2012-05-07 00:08:59 -04:00
parent c3c769060c
commit 279931cd0b
No known key found for this signature in database
GPG Key ID: F22BB8158EE30EAB
2 changed files with 19 additions and 1 deletions

View File

@ -92,7 +92,18 @@
</pre> </pre>
<p> <p>
To prevent a class from being extended, <tt>FinalClass</tt> can be used. Type checks for polymorphic methods may be performed with
<tt>Class.isA()</tt>, which is <a
href="manual/Type-Checks-and-Polymorphism.html" class="man">recommended in
place of <tt>instanceof</tt></a>.
</p>
<pre class="js">
<!--%inc scripts/ex/class-poly.js-->
</pre>
<p>
To prevent a class from being extended, <a href="manual/Final-Classes.html"
class="man"><tt>FinalClass</tt></a> may be used.
</p> </p>
<pre class="js"> <pre class="js">
<!--%inc scripts/ex/class-final.js--> <!--%inc scripts/ex/class-final.js-->

View File

@ -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