Link to home
Start Free TrialLog in
Avatar of __alex
__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);
Avatar of kretzschmar
kretzschmar
Flag of Germany image

Avatar of __alex
__alex

ASKER

Interesting, indeed...
SOLUTION
Avatar of Cayce
Cayce
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of __alex

ASKER

Hi Cayce,
I don't want my Bar.Foo method to be static :-(
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of __alex

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...
Have stored the link but not read yet...

Answer is templates if you've lots of class types.