[fpc-devel] Multiple inheritance

Sven Barth pascaldragon at googlemail.com
Sat Aug 19 09:27:30 CEST 2017

Am 19.08.2017 09:12 schrieb "Ondrej Pokorny" <lazarus at kluug.net>:
> Hello!
> Has anybody thought about multiple inheritance in object pascal? I am now
working on a client-server service that entirely uses ORM. I have several
patterns that repeat all over and some of them do not match into the direct
inheritance schema.
> Any thoughs on it? Is it sensible? How do you solve multiple inheritance?

The designers of Object Pascal decided on purpose against multiple
inheritance as they probably saw the problems that C++ has with them. Even
Java and C#, both clearly influenced by C++ don't support multiple
Just think about one class in the inheritance graph reintroducing a virtual
method with different parameters. What will the final class do then?

Object Pascal already has capabilities in place to deal with the
shortcomings of single inheritance, namely interfaces (multiple of which a
class may implement) and delegation ("implements" keyword). That might
result in more code to write, but the result is cleaner and clearer.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20170819/9b934686/attachment.html>

More information about the fpc-devel mailing list