Is it possible in Delphi to have a callable object like I can do in Python using the __call__() method?

StackOverflow https://stackoverflow.com/questions/21946803

Question

As the question says, using Python I am able to do something like this:

class myCallableClass(object):
    def __call__(self, value):
        return 'myCallableClass: ' + value


my_instance = myCallableClass()

# I am calling the istance of my class like a function
my_var = my_instance('string')

print(my_var) # prints 'myCallableClass: string'

Is there a way to achieve something similar in Delphi?

Was it helpful?

Solution

There is nothing in Delphi like a Python callable object. Or a C++ function call operator().

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top