namespaces
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
namespaces [2018/01/22 05:26] – created wolfgangriedmann | namespaces [2018/08/20 04:07] (current) – wolfgangriedmann | ||
---|---|---|---|
Line 6: | Line 6: | ||
Customer.Item.prg | Customer.Item.prg | ||
- | < | + | < |
class Item | class Item | ||
Line 17: | Line 17: | ||
Supplier.Item.prg | Supplier.Item.prg | ||
- | < | + | < |
class Item | class Item | ||
Line 29: | Line 29: | ||
and now how to use these classes: | and now how to use these classes: | ||
- | < | + | < |
local oSupplierItem as Supplier.Item | local oSupplierItem as Supplier.Item | ||
Line 36: | Line 36: | ||
Please note that with the " | Please note that with the " | ||
- | < | + | < |
local oItem as Item | local oItem as Item | ||
oItem := oItem{}</ | oItem := oItem{}</ | ||
For the compiler, it must be clear which class to use, so if you have use classes that are defined multiple times in different namespaces, you need to fully qualify them. The following code will lead to a compiler warning: | For the compiler, it must be clear which class to use, so if you have use classes that are defined multiple times in different namespaces, you need to fully qualify them. The following code will lead to a compiler warning: | ||
- | < | + | < |
using Supplier | using Supplier | ||
- | local oCustomerItem as Customer.Item | + | local oCustomerItem as Item |
- | local oSupplierItem as Supplier.Item | + | |
- | oCustomerItem := Customer.Item{} | + | oCustomerItem := Item{} |
- | oSupplierItem := Supplier.Item{}</ | + | </ |
because you need to specify which class to take. The compiler has no chance to do that correctly. | because you need to specify which class to take. The compiler has no chance to do that correctly. | ||
namespaces.1516598803.txt.gz · Last modified: 2018/01/22 05:26 by wolfgangriedmann