# Poco

# template < class TObj, class TArgs, bool withSender = true >

# class Delegate

Library: Foundation
Package: Events
Header: Poco/Delegate.h

## Description

Wraps a member function for use as a Delegate. Use withSender=true for callbacks that take sender as first parameter.

## Inheritance

Direct Base Classes: AbstractDelegate < TArgs >

All Base Classes: AbstractDelegate < TArgs >

## Member Summary

Member Functions: clone, disable, equals, notify, operator =

## Types Aliases

### NotifyMethod

using NotifyMethod = std::conditional_t < withSender, void (TObj::*)(const void *, TArgs &), void (TObj::*)(TArgs &)>;

## Constructors

### Delegate

Delegate() = delete;

### Delegate

Delegate(
const Delegate & delegate
);

### Delegate

Delegate(
TObj * obj,
NotifyMethod method
);

## Destructor

### ~Delegate

~Delegate() = default;

## Member Functions

### clone

AbstractDelegate < TArgs > * clone() const;

### disable

void disable();

### equals

bool equals(
const AbstractDelegate < TArgs > & other
) const;

### notify

bool notify(
const void * sender,
TArgs & arguments
);

### operator =

Delegate & operator = (
const Delegate & delegate
);

## Variables

### _mutex

Mutex _mutex;

### _receiverMethod

NotifyMethod _receiverMethod;

### _receiverObject

TObj * _receiverObject;