Click the "Show Inheritance" button to do some evaluation of the created object.
var chicken = new Chicken();
YAHOO.lang comes bundled with the YAHOO Global Object. To add the YAHOO Global Object, include the following in your markup:
If you are using any other YUI component on your page, you should already have
In this example, we create a class
YAHOO.example.Bird then create a subclass
Unlike classes composed with augmentation, extending subclasses are also considered instances of their superclass and all classes higher up the inheritance tree.
We'll create an instance of
YAHOO.example.Chicken and run some
instanceof and method tests against it.
Take a look at
YAHOO.lang.augmentObject for different strategies of managing your code structure.
All YUI 2.x users should review the YUI 2.8.2 security bulletin, which discusses a vulnerability present in YUI 2.4.0-2.8.1.