KiCad PCB EDA Suite
Loading...
Searching...
No Matches
delegate_example.cpp
Go to the documentation of this file.
1
#include <cstdio>
2
#include <string>
3
4
#include <tool/delegate.h>
5
6
class
MyClass
7
{
8
public
:
9
int
MyMethod
(
const
string
& arg )
10
{
11
return
arg.length();
12
}
13
};
14
15
typedef
DELEGATE<int, const string&>
MyDelegate
;
16
17
main
()
18
{
19
MyClass
t1;
20
MyClass
t2;
21
22
MyDelegate
ptr1( &t1, &
MyClass::MyMethod
);
23
MyDelegate
ptr2( &t2, &
MyClass::MyMethod
);
24
25
int
retval1, retval2;
26
27
retval1 = ptr1(
"apples"
);
28
retval2 = ptr2(
"cherries"
);
29
30
return
0;
31
}
MyClass
Definition:
delegate_example.cpp:7
MyClass::MyMethod
int MyMethod(const string &arg)
Definition:
delegate_example.cpp:9
main
main()
Definition:
delegate_example.cpp:17
MyDelegate
DELEGATE< int, const string & > MyDelegate
Definition:
delegate_example.cpp:15
src
include
tool
examples
delegate_example.cpp
Generated on Sun Dec 22 2024 00:05:24 for KiCad PCB EDA Suite by
1.9.6