__alex
asked on
Delphi to C++ (procedure of object)
I wonder how the following snippet will appear in C++.
type
TFoo = procedure(i: integer) of object;
var
foo: TFoo;
...
foo := Bar.Foo;
foo(2);
type
TFoo = procedure(i: integer) of object;
var
foo: TFoo;
...
foo := Bar.Foo;
foo(2);
ASKER
Interesting, indeed...
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Cayce,
I don't want my Bar.Foo method to be static :-(
I don't want my Bar.Foo method to be static :-(
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok, got it. But I need a bunch of classes if I have different "target object" types or use templates, do I?
foo := Bar_1.Foo; // Bar_1 is TBar_1
foo := Bar_2.Foo; // Bar_2 is TBar_2
That gets complicated...
foo := Bar_1.Foo; // Bar_1 is TBar_1
foo := Bar_2.Foo; // Bar_2 is TBar_2
That gets complicated...
ASKER
Have stored the link but not read yet...
Answer is templates if you've lots of class types.
Answer is templates if you've lots of class types.
https://www.experts-exchange.com/questions/10414716/How-to-make-a-Callback-Procedure-Function-to-Procedure-Function-of-Object.html