Hey guys
I’m a Unity programmer of +7 years making the move to Unreal, in other words the transformation from C# to C++
I literally just started today. Nice to meet you!
Not sure where is the best place to post this but I have some C++ questions of which I couldn’t seem to successfully google and figure out myself.
I have some n00b question for you all, so many apologies in advance.
In the getting started section in the Unreal documents I found this bit of code
" virtual void NotifyActorBeginOverlap(AActor* Other) override;"
Can anyone explain why the final “override;” at the end is needed?
Now in Unity C# with virtual functions you do something like
virtual void Moo() {}
and then later on you would override it like this:-
override void Moo() {}
I find it unusual that you would need to use override and virtual in the same declaration. For me, if you declare a virtual function then it should overridable by default.
Another puzzle I encountered was this line (and similar)
“for (TObjectIterator<UMyClass> It; It; ++It)”
A normal for loop goes something like
for(initialization; condition ; increment/decrement)
The above line is more akin to foreach which I believe it is
In Unity C# this is something like
foreach (UMyClass It in UMyClassList)
{
}
However, I don’t under the syntax. To me
for (TObjectIterator<UMyClass> It; ++It)
seems more correct.
or
for (TObjectIterator<UMyClass> It; MyItList; ++It)
If someone could explain the syntax, I would be incredibly grateful.
Thanks for reading this far