Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Can I make an indirect call to an objects method, using a pointer or a procedural type?

0
10 Posted

Can I make an indirect call to an objects method, using a pointer or a procedural type?

0
10

Yes, but you’ll need to make aggressive use of casting, and to have a bit of background on just what a method call is. While method calls look and act very differently than normal calls — the call looks like a reference to one of the object’s fields, and there’s the implicit with Self do that lets us refer to the object’s fields as if they were global variables — at the level of words on the stack they’re not all that different from a normal procedure or function call. All methods have an `invisible’, or implicit, parameter, var Self, after any regular, or explicit, parameters; constructors and destructors also add an implicit word parameter (the 16-bit VMT pointer) between the explicit parameters and Self. Also, while constructors act as if they return a boolean, they actually return a pointer which contains @ Self if Fail was not called, and Nil if it was. The implicit parameters and the special handling of constructor results are the only differences between method calls and norma

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123