TSubobjectPtr<UCameraComponent> TSubclassOf<class AExplosionEffect> ExplosionClass;

When I was doing the tutorial(Unreal Devs - YouTube) why does some of them need class keyword and some of them does not need class keyword ,thx ?

I haven’t looked at those tutorials but I’m pretty sure it’s a C++ thing called forward declaration, here’s a simplified explanation. Each .cpp is compiled separately and doesn’t know about other classes unless you #include their .h files. TSubobjectPtr<UCameraComponent> doesn’t need class keyword because somewhere the header file for UCameraComponent has already been included, so the .cpp knows that UCameraComponent is a class. However, * TSubclassOf<class AExplosionEffect>* does need it, because the header for AExplosionEffect hasn’t been included, and the .cpp has no idea what an AExplosionEffect is supposed to be. The class keyword is telling the .cpp that AExplosionEffect is a class, but without having to tell it what it looks like. This is called forward declaration, and you should look up a tutorial on it because it’s very useful.