In Unreal Project I have this line:
class USpringArmComponent* CameraBoom
and
class UCameraComponent* FollowCamera
And I haven't ever seen this syntax in c++. What does it mean?
It's an elaborated type specifier:
https://en.cppreference.com/w/cpp/language/elaborated_type_specifier
That's just telling the compiler that UCameraComponent is a class. Not anything else. It's like in C you put struct before any structure variable declarations.
This syntax is useful when you have some messy code (or to convey that it is a class verbosely to the developer).
For example:
class counter { // bla bla bla... }; void foo() { int counter = 0; // Oops someone declared a variable called counter. // How am I going to declare a variable of type `counter`?4 // counter actual_counter; // Syntax error: expected ';' after expression. //Because counter is a variable class counter actual_counter; // You prepend `class` to the deceleration } class std::basic_string<char, std::char_traits<char>, std::allocator<char> > s; But it doesn't parse with the typedef class std::string s;.
class? In either case I would suggest read more about C (read aboutstructsinstead ofclasses) because both these come from C.*means the type is a pointer, and the pointer may point to aUSpringArmComponenttype (in the first case) for the variableCameraBoom, or to aUCameraComponenttype (in the second case) for the variableFollowCamera.