Hello I have been looking through some of the source code and noticed forward declarations being used at file scope in some places and as part of a member declaration in other cases.
Apart from the file scope case obviously being less cumbersome just like a ‘using namespace’ at the top is there some sort of technical difference?
Would there be any difference between a native c++ class and a UE class?
What about a UPROPERTY or UFUNCTION?
I have been trying to find posts about this topic but have been unsuccessful. I would also like to know the names of the 2 different approaches thanks!
File scope case:
#includes...
class Foo;
class Bar
{
UFUNCTION(BlueprintCallable, Category = "Forward Declaration and some FooBar's")
Foo* u_GetFoo();
Foo* GetFoo();
UPROPERTY()
Foo* u_ptr;
Foo* ptr;
}
Member declaration case:
#includes...
class Bar
{
UFUNCTION(BlueprintCallable, Category = "Forward Declaration and some FooBar's")
class Foo* u_GetFoo();
class Foo* GetFoo();
UPROPERTY()
class Foo* u_ptr;
class Foo* ptr;
}