Hello,
I’m learning implementation of OOP in JS, and seem to be getting conflicting answers from Javascript textbooks and Unity JS tuts.
Case in point:
function smpl_generic (a: float, b: float, c: float)
{
this.a = a;
this.b = b;
this.c = c;
}
…barfs with ‘a’ not being a member of smpl_generic (filename). Google book link in context.
This, from a WalkerBoy tutorial seems to work, however:
class Test
{
var a;
function Test(aA: float)
{
a = aA;
}
}
To compound my confusion, from what I’ve been reading is that JS creates classes by itself without announcing them, and that I need to create prototypes for methods. This is NOT from what I’ve seen being written.
In the link I provided (it’s just a single block of text), can someone explain to me what exactly differs in Unity’s implementation of JS?