http://blog.csdn.net/yincheng01/article/details/6841953 Metro C++
http://www.cnblogs.com/michaelxu/archive/2008/09/20/1293716.html 线程同步
JavaScript 继承总结。三角形和四边形都是继承自多边形
//多边形 function Polygon(iSides) { this.sides = iSides; } Polygon.prototype.getArea = function () { return 0; }; //三角形 function Triangle(iBase, iHeight) { Polygon.call(this, 13); this.base = iBase; this.height = iHeight; } Triangle.prototype = new Polygon(); Triangle.prototype.getArea = function () { return 0.5 * this.base * this.height; }; //四边形 function Rectangle(iLength, iWidth) { Polygon.call(this, 14); this.length = iLength; this.width = iWidth; } Rectangle.prototype = new Polygon(); Rectangle.prototype.getArea = function () { return this.length * this.width; };
//输出结果 var triangle = new Triangle(122, 4); var rectangle = new Rectangle(222, 10); alert(triangle.sides); //结果:13 alert(triangle.getArea()); //结果:244 alert(rectangle.sides); //结果:14 alert(rectangle.getArea()); //结果:2220