今天遇到一个题目 分析下面的代码,判断代码是否有误. using System; namespace Test1 { class Point { public int x; public int y; } class Program { static void Main(string[] args) { Point[] pointArr = ]; pointArr[].x = ; pointArr[].y = ; pointArr[].x = ; pointArr[].y = ; pointAr
第一种模式: function Person(){ } Person.prototype.say=function(){ alert('hello'); } var person=new Person(); person.say();//hello 依据第一种模式说一下继承的实现: function Person(){ } Person.prototype.say=function(){ alert('hello'); } function Man(){} Man.prototype=new P
面向对象的三大特性: 封装 a) 把一些属性和方法装到一个对象里 2. 继承 a) js中的继承是指: 一个对象没有一些方法和属性,而另一个对象有 把另一个个对象的属性和方法,拿过来自己用,这就是继承 b) 混入式继承 for … in 1. 父类的属性和方法在所有之类 3. 多态 a) JS中没有相应的体现 b) 在强类型语言比较常见 c) 实用父类的变量接受子类的对象 d) 父类的属性方法供所有的子类共享 创建对象的方式 1. 创建对象 四种方法: 1.字面