[fpc-pascal] corba interfaces - is/as not working properly
David Emerson
dle3ab at angelbase.com
Wed Sep 28 23:56:11 CEST 2016
On 09/28/2016 12:40 PM, Lars wrote:
> Curious, where do corba interfaces come in handy ? When can you use them
> that object oriented code won't offer the same features?
For multiple inheritence, since fpc does not support multiple
inheritence without interfaces. Interfaces are an addition to object
oriented code, not separate from it.
In my particular case, in a project of mine in which I am drawing
lattices, I have a concept of a node. Sometimes I want to draw that node
myself using AGGPAS, and sometimes I want that node to itself be a
Window/Widget, descending from fpGUI classes. If I'm using AGGPAS to
draw the node, then I don't want the node to descend from fpGUI -- I use
my own lighter-weight class hierarchy. So in order to be able to treat
these two things the same, I define "enclosing node" as an interface.
Now I can have classes descending from two (or more) different
hierarchies, which both implement the enclosing node interface. I can
write functions to do things with enclosing nodes, and get the benefits
of polymorphism with multiple inheritence.
All that said, interfaces have their quirks and I wish we had more
native support for multiple inheritence (also templates but that's
another story) but anyway I'll take what I can get :-)
~David.
More information about the fpc-pascal
mailing list