衍生內建建構器的子類別 subclass

衍生內建建構器的子類別 subclass

Subclassing a built-in 的兩個障礙:

Obstacle 1 帶有內部特性的實體

1
2
3
4
5
6
7
8
9
10
function Super(x, y){
this.x = x;
this.y = y;
}

function Sub(x, y ,z){
Super.call(this, x, y);
this.z = z;
}

內建建構器會忽略傳入傳入作為this的子實體

Read more
Your browser is out-of-date!

Update your browser to view this website correctly.&npsb;Update my browser now

×