Page 1 of 1

Disambiguation of classes with identical names from different packages

Posted: Thu Jul 22, 2021 6:02 pm
by Masterkent
Suppose we have two classes: UnrealShare.Scorch and Botpack.Scorch.

How does the compiler choose what class is being referenced when we use the unqualified class name Scorch?

Code: Select all

class DerivedScorch expands Scorch;

static function Scorch func(Scorch Param)
{
    local Scorch Variable;
    local Actor A;

    Variable = Param.Spawn(class'Scorch');
    A = Variable;

    Log(Scorch(A));
    Log(class<Scorch>(A.Class));

    return Variable;
}
Is there a way to specify the package name in function return types, parameter declarations, variable declarations, and type conversions?

Code: Select all

class DerivedScorch expands Botpack.Scorch; // works

static function Botpack.Scorch func(Botpack.Scorch Param) // doesn't work
{
    local Botpack.Scorch Variable; // doesn't work
    local Actor A;

    Variable = Param.Spawn(class'Botpack.Scorch'); // works
    A = Variable;

    Log(Botpack.Scorch(A)); // doesn't work
    Log(class<Botpack.Scorch>(A.Class)); // doesn't work

    return Variable;
}