- Code: Select all • Expand view
class BaseClass abstract
{
abstract void F1(out int ticker);
abstract void F2(out int ticker);
}
class DerivedClass : BaseClass
{
override void F1(out int ticker)
{
Console.Printf("F1: %i", ticker);
}
override void F2(int ticker)
{
Console.Printf("F2: %i", ticker);
}
}
class OutParamTest : Actor
{
override void BeginPlay()
{
Super.BeginPlay();
cls = new('DerivedClass');
}
override void Tick()
{
cls.F1(Ticker);
cls.F2(Ticker);
Ticker++;
Super.Tick();
}
int Ticker;
BaseClass cls;
}
This results in F1 printing the correct number: 0, 1, 2, 3 and so on, but F2 prints out some 10 digit negative number.
I had this happen in some code elsewhere and had to spend some good 20 minutes to figure out where the problem was exactly. Shouldn't this be a warning at the very least? This also sounds like a possible security concern.