Would it not be better to forward declare UPhysicsHandleComponent?

Rather than move the UPhysicsHandleComponent.h header into Grabber.h, since GetPhysicsHandle is private and we don’t need to know the implementation of UPhysicsHandleComponent outside of Grabber.cpp shouldn’t we just forward declare UPhysicsHandleComponent?

Yes, though forward declarations aren’t covered until the following section.

That has nothing to do with whether a type should be forward declared or not. In a header file any type that can be forward declared should be.
This makes the header file as isolated as possible; so any file that includes gets only what it is strictly necessary so that it doesn’t include headers it may not need.

Yes I have just done the following section and have seen this now.

I’m using Rider instead of VSCode and these things like this are getting flagged up immediately.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms