View Full Version : Object child, referenceing the parent or constructor?
Bob90
04-12-2007, 06:04 PM
Hi, so here's the problem....
I create an object with new
new Owner();
function Owner()
{
new Pet();
}
function pet()
{
this.parent = ????????
}
How do I reference the constructors object, which is the question marks?
:)
Bob90
04-12-2007, 06:24 PM
Just pass the parent object as an argument
mburt
04-12-2007, 06:33 PM
Using arguments when parent is already specified may cause some problems. Two variables are defined, obj.parent, and arguments[0]. They may overlap.
How do I reference the constructors object, which is the question marks?
pet.parent I think. I'm not sure if functions are meant to be objects in this case.
If you did:
var t = new pet();
alert(t.parent)
In this case, t is the object and parent is one of it's nodes.
Powered by vBulletin® Version 4.2.2 Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.