Extending class without inheritance |
|
Re: Extending class without inheritance |
|
> {quote:title=Gilbert Padilla wrote:}{quote}
> Advantage or limitations of class helpers vs. the Decorator pattern
>
> Or any other suggestions ?
Interfaces and aggregation.
An interface is a contract (describes what an object does), not how it's implemented. For example, an "iLogfile" interface could be a file, a stringlist or a serial comms class and all would be perfectly interchangeable though none of them share a common base class. They need not even derive from tInterfacedObject (one can add the nuts and bolts such as _addref manually).
|