Recent

Author Topic: How to use interfaces  (Read 5303 times)

Thaddy

  • Hero Member
  • *****
  • Posts: 19288
  • Glad to be alive.
Re: How to use interfaces
« Reply #15 on: October 06, 2021, 12:18:15 pm »
Hello @everyone,

Would an article with a T[Contained|Aggregated]Object example (explaining how to use interfaces in such classes in order to remain in the explicit Free Object Pascal (Create..Free) memory management paradigm) be useful ( source: https://forum.lazarus.freepascal.org/index.php/topic,46181.msg328478.html#msg328478; personally, I don't like reference counting. I prefer to keep control over explicitly destroy everything that I've previously created)?
That is another discussion and does not belong in this one.
objects are fine constructs. You can even initialize them with constructors.

devEric69

  • Hero Member
  • *****
  • Posts: 657
Re: How to use interfaces
« Reply #16 on: October 06, 2021, 12:30:19 pm »
Interfaces are handy, in order to extract bundles of some related thematic methods a.k.a. thematic APIs, and group them together in their interface. After that, I just want to show that there is a method to inject such created thematic interfaces, into few specialized class that which allows us to continue to stay in an explicit (Create...Free) memory management mode. Nothing more (I dont want to discuss about COM versus CORBA interfaces: it should be covered in an another article).
« Last Edit: October 06, 2021, 12:32:07 pm by devEric69 »
use: Linux 64 bits (Ubuntu 20.04 LTS).
Lazarus version: 2.0.4 (svn revision: 62502M) compiled with fpc 3.0.4 - fpDebug \ Dwarf3.

 

TinyPortal © 2005-2018