While trying to realize factories within Structs I came across something that's possibly a Bug. It compiles fine, but a static Method seems to return the wrong thing...
simplified example:
struct Info
{
double a;
double b;
double c;
Info() : a(1.1), b(2.2), c(3.3) {}
Info(double a, double b, double c) : a(a), b(b), c(c) {}
Info TestFactory(constdouble a, constdouble b, constdouble c) const;
static Info StaticFactory(constdouble a, constdouble b, constdouble c);
};
Info Info::TestFactory(constdouble a, constdouble b, constdouble c) const
{
Info result(a, b, c);
return result;
}
static Info Info::StaticFactory(constdouble a, constdouble b, constdouble c)
{
Info result(a, b, c);
return result;
}
voidOnStart()
{
Info info1, info2, info3;
info2 = info1.TestFactory(4.4, 5.5, 6.6);
info3 = Info::StaticFactory(7.7, 8.8, 9.9);
Print(info1.a); // Prints 1.1 OK!Print(info2.a); // Prints 4.4 OK!Print(info3.a); // Prints 1.1 ERROR! should be 7.7
}
The static Factory returns an Info struct initialized with the standard constructor, ignoring the parameters ???
While trying to realize factories within Structs I came across something that's possibly a Bug.
It compiles fine, but a static Method seems to return the wrong thing...
simplified example:
The static Factory returns an Info struct initialized with the standard constructor, ignoring the parameters ???
Is this a Bug or me doing something wrong?
regards
Daniel