title: How do I get c++ inheritance working in actors when I can only inherit from non-UObjects?
body: <p>I am currently trying to implement inheritance like I would in any other project but I keep getting an error telling me that I can only inherit from non-UObjects or UInterface derived interfaces. I am trying to make a MasterEntity class that inherits AActor, and then I would have subclasses PlayerCharacter and NonPlayerCharacter that share certain variables like health, but I cannot get this seemingly simple task to work.</p>
  <h2>My current files are as follows</h2>
  <p>MasterEntity.h:</p>
  <pre><code>// Fill out your copyright notice in the Description page of Project Settings.
  
  #pragma once
  
  #include &quot;CoreMinimal.h&quot;
  #include &quot;GameFramework/Actor.h&quot;
  #include &quot;MasterEntity.generated.h&quot;
  
  UCLASS()
  class THIRDPERSONGAME_API AMasterEntity : public AActor
  {
      GENERATED_BODY()
      
  public: 
      // Sets default values for this actor's properties
      AMasterEntity();
  
  protected:
      // Called when the game starts or when spawned
      virtual void BeginPlay() override;
  
  public: 
      // Called every frame
      virtual void Tick(float DeltaTime) override;
  
      UPROPERTY(EditAnywhere, BlueprintReadWrite)
      int32 maxHealth;
  
  };
  </code></pre>
  <p>PlayerCharacter.h</p>
  <pre><code>// Copyright Epic Games, Inc. All Rights Reserved.
  
  #pragma once
  
  #include &quot;CoreMinimal.h&quot;
  #include &quot;GameFramework/Character.h&quot;
  #include &quot;Components/BoxComponent.h&quot;
  #include &quot;InteractionInterface.h&quot;
  #include &quot;MasterEntity.h&quot;
  #include &quot;PlayerCharacter.generated.h&quot;
  
  UCLASS(config=Game)
  class APlayerCharacter : public ACharacter, public AMasterEntity
  {
      GENERATED_BODY()
  
  
  public:
      APlayerCharacter();
  
      
  protected:
  
      /** Called for forwards/backward input */
      void MoveForward(float Value);
  
      /** Called for side to side input */
      void MoveRight(float Value);
  
      /** 
       * Called via input to turn at a given rate. 
       * @param Rate  This is a normalized rate, i.e. 1.0 means 100% of desired turn rate
       */
      void TurnAtRate(float Rate);
  
      /**
       * Called via input to turn look up/down at a given rate. 
       * @param Rate  This is a normalized rate, i.e. 1.0 means 100% of desired turn rate
       */
      void LookUpAtRate(float Rate);
  
  protected:
      // APawn interface
      virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
      // End of APawn interface
  
      virtual void BeginPlay() override;
  
      void OnInteract();
  
  public:
      virtual void Tick(float DeltaSeconds) override;
  
  private:
      UPROPERTY(EditAnywhere)
      UBoxComponent* InteractionBox;
  
      IInteractionInterface* Interface = nullptr;
  };
  
  
  </code></pre>
  <p>What am I missing that will let me do this? I believe I can use components instead, but that seems really messy for what I am trying to do. I tried making the MasterEntity class just a regular C++ class and inheriting that, which didn't give me any compilation errors, but I wasn't able to see any values (like the maxHealth variable) from that in the blueprint editor.</p>