var a = new Object; //or var a = make_me_obj();, where make_me_obj
creates user defined object from C++.
var b = a;
the var b will have the copy of value a or just another reference to an
object in var a? From what it depends?
and question, is any example (wrote on C++) of class with private data,
which made copy itself in var b in case, described above. More interested in
coding of copy constructors, and order of allocing/deallocing memory for
private data.
Thanks.
> Hello.
> I can't clearly understand what happened in this case:
>
> var a = new Object; //or var a = make_me_obj();, where make_me_obj
> creates user defined object from C++.
> var b = a;
>
> the var b will have the copy of value a or just another reference to an
> object in var a?
Just the reference -- objects are reference types in JS, as in Java.
What is entailed by copying an object depends on the class of the object
and how you use it, so it's up to you to make a copy or clone method.
You need to allocate and set private data in any constructor-like native
function you write, of course. The JSClass.finalize hook should get and
deallocate the private data for the object being finalized.
/be