It is impossible to pass objects to a constructor of a class through the first parameter. If you try to pass an object of class A to the constructor of class B, the debugger reports the following error: "class A has no accessible B method with 1 parameter."
To reproduce, try this code:
// Begin Code
class oneClass
{
public:
function oneClass(val)
{
mVal = val;
}
function value()
{
return mVal;
}
private:
var mVal;
}
class otherClass
{
public:
function otherClass(oneClass obj)
{
mVal = obj->value;
}
function value()
{
return mVal;
}
private:
var mVal;
}
a = oneClass(2);
b = otherClass(a);
// End Code
The problem was originally discovered calling a constructor with an object of the same class as an argument (function classA(classA obj)), for which the debugger simply reports: "Invalid object."
To reproduce this, try:
// Begin Code
class thirdClass
{
public:
function thirdClass()
{
mVal = 2;
}
function thirdClass(thirdClass obj)
{
mVal = obj->mVal + 2;
}
function value()
{
return mVal;
}
private:
var mVal;
}
c = thirdclass();
d = thirdclass(c);
// End Code
Including other parameters before the parameter taking the object resolves this issue. Parameters after the object parameter have no effect.