Z
zzw8206262001
Hi,I find a way to make javescript more like c++ or pyhon
There is the sample code:
function Father(self) //every contructor
//may have "self" argument
{
self=self?self:this; //every class may
//have this statement
self.hello = function()
{
alert("father"+self.name);
}
self.name = "baibai";
}
function Child(self) //every contructor
//may have "self" argument
{
self=self?self:this; //every class may
//have this statement
//inherit from faher
Father(self);
self.hello = function()
{
alert("child"+self.name);
}
}
a = new Father();
a.hello();
b = new Child();
b.hello();
There is the sample code:
function Father(self) //every contructor
//may have "self" argument
{
self=self?self:this; //every class may
//have this statement
self.hello = function()
{
alert("father"+self.name);
}
self.name = "baibai";
}
function Child(self) //every contructor
//may have "self" argument
{
self=self?self:this; //every class may
//have this statement
//inherit from faher
Father(self);
self.hello = function()
{
alert("child"+self.name);
}
}
a = new Father();
a.hello();
b = new Child();
b.hello();