7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2024-11-22 03:15:02 +00:00
kicad/include/tool/examples/delegate_example.cpp
Wayne Stambaugh ede39780e2 Remove all debugging output that cannot be disabled.
The use of printf, wxLogDebug, and std::err/std::out causes excessive
debugging output which makes finding specific debugging messages more
difficult than it needs to be.

There is still some debugging output in test code that really needs to
be moved into a unit test.

Add debugging output section to the coding policy regarding debugging
output.
2020-08-18 10:17:36 -04:00

32 lines
471 B
C++

#include <cstdio>
#include <string>
#include <tool/delegate.h>
class MyClass
{
public:
int MyMethod( const string& arg )
{
return arg.length();
}
};
typedef DELEGATE<int, const string&> MyDelegate;
main()
{
MyClass t1;
MyClass t2;
MyDelegate ptr1( &t1, &MyClass::MyMethod );
MyDelegate ptr2( &t2, &MyClass::MyMethod );
int retval1, retval2;
retval1 = ptr1( "apples" );
retval2 = ptr2( "cherries" );
return 0;
}