Class("Point", {
has: {
x: {is: "rw"},
y: {is: "rw"}
},
methods: {
clear: function () {
this.setX(0);
this.setY(0);
}
}
});
Class("Point3D", {
isa: Point,
has: {
z: {is: "rw"}
},
after: {
clear: function () {
this.setZ(0);
}
}
});
Point3D is a subclass of Point. It has another attribute defined and additional code to run after running the superclass clear() method. The "rw" means the attribute is readable and writable with a pair of get/set accessors generated automatically.