Getting error

I tried to add to array a variable from datatable, which was declared using TSubclassOf.
And i got this error

this is cpp file

AMainItem* Item = ItemDataTable[ArrayIndex]->FindRow(FName(FString::FromInt(IndexOfElement)), “”, false)->Item;

this is my struct in h file

struct FRandomItemData : public FTableRowBase

		TSubclassOf<AMainItem> Item;
		int32 Amount = 1;
		int32 Cost = 1;


A TSubclassOf is a type safe wrapper of UClass* which contains reflected metadata about some type. It is not something that will exist in the game world.

Your code is trying to do this

TSubclassOf<AMainItem> ItemClass;
AMainItem* Item = ItemClass

Which doesn’t make sense, a UClass* can’t be converted to the type that it is a reflection of.