It is possible. It involves a little work, though. From looking at the generated C++ from a 4.6 project, it looks like this may have changed for 4.6, but in 4.5 and earlier, the C++ classes have a project-specific Macro. For example, for one test project I have, it looks like this:
UCLASS()
class REPUBLICSNIPERAI_API AEnemyCharacter : public ABaseNPCCharacter
{
GENERATED_UCLASS_BODY();
The REPUBLICSNIPERAI_API was auto-generated by UE4 based on the name of my project (RepublicSniperAI). In the project settings, it is defined as an empty string, so it has no effect on the generated code. I don’t know the full affect of this macro or how it’s used by UE4’s build system. With 4.6, it appears to no longer be used, but I’m not sure if something else takes its place.
So, to migrate the code, you copy the .h and .cpp files to your new project’s source folder, then you need to change this macro to the class-specific macro for your project. If the project you’re migrating to is a 4.6 project, it looks like you would simply remove the macro altogether, but maybe someone more familiar with the 4.6 engine changes can confirm that.
After that, there’s one more step you need to take. The blueprints that subclass or reference your migrated classes will have a reference based on the name of your old project. In order to deal with that, you need to put Active Class Redirects into your project’s* DefaultEngine.ini* file in your project’s Config folder. For each class that is used in Blueprints, you need to do something like this at the end of the DefaultEngine.ini file:
[/Script/Engine.Engine]
+ActiveClassRedirects=(OldClassName="EnemyCharacter",NewClassName="/Script/.EnemyCharacter")
+ActiveClassRedirects=(OldClassName="EnemyController",NewClassName="/Script/.EnemyController")
+ActiveClassRedirects=(OldClassName="BaseNPCCharacter",NewClassName="/Script/.BaseNPCCharacter")
+ActiveClassRedirects=(OldClassName="BaseNPCController",NewClassName="/Script/.BaseNPCController")
+ActiveClassRedirects=(OldClassName="FriendCharacter",NewClassName="/Script/.FriendCharacter")
+ActiveClassRedirects=(OldClassName="FriendController",NewClassName="/Script/.FriendController")
+ActiveClassRedirects=(OldClassName="NavigationMarker",NewClassName="/Script/.NavigationMarker")
+ActiveClassRedirects=(OldClassName="BTTask_MoveToward",NewClassName="/Script/.BTTask_MoveToward")
+ActiveClassRedirects=(OldClassName="BTTask_SelectRandomLocation",NewClassName="/Script/.BTTask_SelectRandomLocation")
+ActiveClassRedirects=(OldClassName="BTTask_StopMoving",NewClassName="/Script/.BTTask_StopMoving")
+ActiveClassRedirects=(OldClassName="BTDecorator_IsMoving",NewClassName="/Script/.BTDecorator_IsMoving")
[FONT=Courier New]OldClassName is the unmodified name of the C++ class without the prefix character (e.g. [FONT=Courier New]EnemyCharacter, not [FONT=Courier New]AEnemyCharacter). [FONT=Courier New]NewClassName takes the form [FONT=Courier New]/Script/ProjectName.classname.
Once you’ve done that, you should be able to migrate the blueprints from the editor to your new project the way you would any other blueprint.
Hope that helps.