Box->OnComponentHit.AddDynamic(this, &ADoor::Collide);
and cpp definition for the hit inside of the door class:
void ADoor::Collide(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComponent, FVector NormalImpulse, const FHitResult& Hit) {
}
You can use the dot operator (.) only when accessing a direct reference of an object.
Here the box is a pointer. Pointers are accessed through the arrow operator (->)