# Overloading a UFUNCTION

**URL:** <https://forums.unrealengine.com/t/overloading-a-ufunction/337808>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [November 8, 2015, 5:33am UTC](https://forums.unrealengine.com/t/overloading-a-ufunction/337808 "2015-11-08T05:33:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dirt113](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dirt113](https://forums.unrealengine.com/u/Dirt113)\
**Post date:** [November 8, 2015, 5:33am UTC](https://forums.unrealengine.com/t/overloading-a-ufunction/337808/1 "2015-11-08T05:33:39Z")

</div>

I want to overload a UFUNCTION CanFire() with CanFire(bool, bool)

```
	UFUNCTION(BlueprintCallable, Category = "Status|Get")
		// Check if character meets the requirements to fire
		bool CanFire() const;

	UFUNCTION(BlueprintCallable, Category = "Status|Get")
		/* Check if character meets the requirements to fire
		 * @param bCheckMovement : true to check movement, otherwise false
		 * @param bFalseIfFiring : true to account for current fire state, otherwise false
		 */
		bool CanFire(bool bCheckMovement, bool bFalseIfFiring) const;

////////// .cpp //////////

// Check if character meets the requirements to fire
bool ADHCharacter::CanFire() const
{
	return GetCurrentWeaponInfo().CanFire();
}

/* Check if character meets the requirements to fire
 * @param bCheckMovement : true to check movement, otherwise false
 * @param bFalseIfFiring : true to account for current fire state, otherwise false
 */
bool ADHCharacter::CanFire(bool bCheckMovement, bool bFalseIfFiring) const
{
	if (!((bCheckMovement && bIsSprinting) && (bFalseIfFiring && bIsFiring))) return GetCurrentWeaponInfo().CanFire();
	else return false;
}

```

However, this creates an error on compile:

```
1> D:/Library Storage/Documents/Unreal Projects/DistantHome/Source/DistantHome/Public/Player/DHCharacter.h(173) : 'CanFire' conflicts with 'Function /Script/DistantHome.DHCharacter:CanFire'

```

So how do I overload a UFUNCTION?

I want to avoid:

```
#define CAN_FIRE CanFire(false, true)
```

---

<div class="post-metadata">

**Author:** ![ThePathfinder](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/thepathfinder/32/465700_2.png) [@ThePathfinder](https://forums.unrealengine.com/u/ThePathfinder)\
**Post date:** [November 8, 2015, 9:15am UTC](https://forums.unrealengine.com/t/overloading-a-ufunction/337808/2 "2015-11-08T09:15:48Z")

</div>

Hi Dirt113,

if nothing has changed. Overloading of UFUCTION is not possible. Other people asked it. See

> **[Why does function declaration with the same name with different number of...](https://forums.unrealengine.com/questions/45623/function-declaration-with-the-same-name-with-diffe.html)**
>
> Hi, Let say that I want to do in my header file: UFUNCTION() FStringAssetReference getDefaultPawn(EName::Type Name); UFUNCTION() FStringAssetReference getDefaultPawn(EName::Type Name, uint8 Level); Here is the error that I have: ...

maybe it is possible for you to rename the overloaded function in something like this:

```
 bool CanFireWithParams(bool bCheckMovement, bool bFalseIfFiring) const;

```

Don’t know which name maybe suit for you.

Have a good day.

---

<div class="post-metadata">

**Author:** ![Dirt113](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dirt113](https://forums.unrealengine.com/u/Dirt113)\
**Post date:** [November 8, 2015, 11:37am UTC](https://forums.unrealengine.com/t/overloading-a-ufunction/337808/3 "2015-11-08T11:37:25Z")

</div>

Thanks for the reply 😃
