# Delegate Syntax C++

**URL:** <https://forums.unrealengine.com/t/delegate-syntax-c/384605>\
**Category:** C++\
**Tags:** syntax, UE4-12, unreal-engine, delegates, CPP, question\
**Created:** [February 11, 2017, 5:48am UTC](https://forums.unrealengine.com/t/delegate-syntax-c/384605 "2017-02-11T05:48:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Floating\_Orb](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Floating\_Orb](https://forums.unrealengine.com/u/Floating_Orb)\
**Post date:** [February 11, 2017, 5:48am UTC](https://forums.unrealengine.com/t/delegate-syntax-c/384605/1 "2017-02-11T05:48:51Z")

</div>

I am trying my hand at delegates in Unreal for the first time and I just cannot seem to get the syntax right. Any help would be greatly appreciated, thank you.

Class1.h

DECLARE\_MULTICAST\_DELEGATE(ON\_LANGUAGE\_CHANGE);

Class1

{  
private:

```
                ON_LANGUAGE_CHANGE LanguageChangeDelegate;

```

}

Class1 cpp

void Class1::AFunction(FString target)

{

```
LanguageChangeDelegate.Add(this, &Class2::ADifferentFunctionInClass2, (FString)target);

if (LanguageChangeDelegate.IsBound())
{
	LanguageChangeDelegate.Broadcast(target);
}

```

}

---

<div class="post-metadata">

**Author:** ![project.gheist](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@project.gheist](https://forums.unrealengine.com/u/project.gheist)\
**Post date:** [February 11, 2017, 9:10am UTC](https://forums.unrealengine.com/t/delegate-syntax-c/384605/2 "2017-02-11T09:10:26Z")

</div>

Hi KaiL25,

You are using a delegate that doesn’t have parameters however you are passing through one. You should use `DECLARE_MULTICAST_DELEGATE_OneParam`.

Cheers,

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [February 11, 2017, 4:47pm UTC](https://forums.unrealengine.com/t/delegate-syntax-c/384605/3 "2017-02-11T16:47:29Z")

</div>

Name and then param types, like this

DECLARE\_MULTICAST\_DELEGATE\_OneParam(FOnLanguageChange,FString);

It’s not cocde breaker but in UE4 coding style delegates should be named same as structs so FSomethingSomething

---

<div class="post-metadata">

**Author:** ![Floating\_Orb](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Floating\_Orb](https://forums.unrealengine.com/u/Floating_Orb)\
**Post date:** [February 12, 2017, 4:07am UTC](https://forums.unrealengine.com/t/delegate-syntax-c/384605/4 "2017-02-12T04:07:25Z")

</div>

There must be something else I’m missing. I am still getting errors.

 ![125935-delegateserror0.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/f/b/9fb84c0fb9019178468957300d9788321e0db169.jpeg)

![125936-delegateserror1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/2/3/82347199d15e845354cf9b3e6b94a048646b8f95.jpeg)

 ![125937-delegateserror2.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/a/9/7a9f6c0b093ad27471f802c609e9427091f54fe1.jpeg)

 ![125938-delegateserror3.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/0/5/c056424bf16a2574b84de4ec5512831d670e2419.jpeg)
