I said its wrong to allocate like this, and its wrong to return a pointer to a stack object. Otherwise
MyClass myObject; // stack object
MyClass *myPointer; // pointer, not valid until you assign something to it
myPointer = &myObject; // let it point to myObject, its useable now
is alright. The & before the variable name gets you the memory address of the variables contents. All this has been written about for like since the 80ies or something, so really google around a bit. I don’t mean it mean.
Try it out with ints or simple classes, move variables and pointer around (and try returning stuff like in your example, what happes? Compiler error, program failure, nothing?) , use the watch window of VS and look what happens with the variabls. And try to understand when and why to use new and delete, and in case of UE, when and why you dont need to think about delete anymore or when you really still should.
Its just a bit laborous and seems complicated, it will just make ‘click’ once and you’ve got it once and for all (what pointers are, new and delete seem to be a source of errors even for the best programmers around).