I am currently learning C++ in UE4 or shall I say UE4 C++. I am trying to look at the C++ source code of my project, yet I see something like this void AMyActor::BeginPlay()
. I am thinking AMyActor
is a namespace but I don´t understand why there is void
in front of it.
Asked
Active
Viewed 189 times
-1

JaMiT
- 14,422
- 4
- 15
- 31
-
2Is `void` the return type of the function? – M. Zhang Jan 06 '22 at 00:41
-
7You really need to [get a book](https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list) that explains how `C++` works and study that first. – Galik Jan 06 '22 at 00:41
-
4`AMyActor` is most likely a class and `void AMyActor::BeginPlay()` is most likely a function. – drescherjm Jan 06 '22 at 00:41
-
6This is like trying to learn how to be come a civil engineer solely by studying the blueprints for the Eiffel Tower. It is necessary to first learn the core fundamentals of C++ by following an organized, methodical, study curriculum in a quality C++ textbook before diving in and trying to understand how an extremely complicated, large C++ code base work, and how it does what it does. – Sam Varshavchik Jan 06 '22 at 00:44
-
UE4 uses "classic" as opposed to "Modern" C++. Getting good with basic C++ is not a lot of study. By that I mean chapters 1 to 7 on "C++ Primer" that @Galik recommended. https://www.amazon.com/Primer-5th-Stanley-B-Lippman/dp/0321714113 – Jan 06 '22 at 00:53
-
*"I am thinking `AMyActor` is a namespace"* -- the name `AMyActor` suggests that it is defined by your project, which would mean that you should *know* -- not merely think -- what `AMyActor` is. Knowing what your identifiers represent is an important step towards knowing why they are used. This brings up another question -- do you know what `BeginPlay` is? – JaMiT Jan 06 '22 at 00:54
1 Answers
2
I see something like this
void AMyActor::BeginPlay()
. I am thinking AMyActor is a namespace but I don´t understand why there is void in front of it.
void
is a keyword. It is a special type. It cannot be the name of a namespace.
void AMyActor::BeginPlay()
is a function declaration. void
is the return type of the function.

eerorika
- 232,697
- 12
- 197
- 326