[Gambas-user] Idea for 3.17
chrisml at deganius.de
Mon May 10 00:05:40 CEST 2021
Am 09.05.21 um 22:50 schrieb Dimitris Anogiatis:
> So if I understand the concept of namespaces, we're talking about
> merging code from 2 or more classes inheriting and overriding methods
> and properties of those classes.
No, no, no. This happens only *without namespaces*. What you describe is
the standard behaviour of Gambas:
The first class 'Mail' is loaded. The second class 'Mail' which is
loaded afterwards overwrites/inherits the first one.
Sometimes this is a very nice feature. But it is deadly if you want to
use a library with code which was written by someone else which you can
download from Gitlab and integrate in your program.
Because if you load such a library classes with the same names ('Mail'
in the library and 'Mail in your program') will inherit/overwrite each
other and this will crash your program with high probability!
This happens with the current Gambas we all work with.
> How would the inheritance mechanism work? For example let's say we have
> the mail class and we import my class and yours like this (again if I
> understand it correctly... if not please correct me):
> import christof:Mail
> import dimitris:Mail
You can use them independently of each other. There is *no inheritance*.
It is the great advantage of namespaces, again:
(To be precise: No automatic inheritance.)
If it helps you then you can see it as if you would call the classes:
Dies ist keine Signatur
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 833 bytes
Desc: OpenPGP digital signature
More information about the User