What is connection beteween UCLASS and UOBJECT? How does this connection work?

What is connection beteween UCLASS and UOBJECT? How does this connection work? I am trying to understand how this mechanism work…
Thank you in advance…

UObject class is the base class for almost all the classes in unreal for ex, AActor,UActorComponent and so on, UClass is also derived from UObject.
Now whenever you mark any of your classes with a UCLASS() what it does is it generates the UClass for that UObject that is it generates reflection code for that UObject Class.

Now what do you mean by reflection code? read it here its in context to java but will give you an idea

Now since C++ hasnt got any inbuilt reflection system thats why we have to mark classes and functions and even properties with Umacros that is UCLASS() ,UFUNCTION(),UPROPERTY() so that we get the reflection code generated for them.

Then what is UClass basically?
So the type you use in java for reflection code sometimes for ex,

Class lostClass=someClass.getClass();

is Class ,so basically UClass is a substitute for Class in the Unreal version of C++, so that you could do sething like

     UClass TestClass = SomeUObjectClass.GetClass();
/// And then you can query about its name or even call methods on this class

Hope you understand it :slight_smile: