1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
Different from the tt(Math:Utility) partition the tt(Math:Add) partition
em(does) depend on another partition: it depends on tt(Math:Utility). Like
tt(Utility's modutility.cc) it starts its tt(modadd.cc) file by exporting its
partition name. But then it imports tt(:Utility), since that partition is used
by tt(Math:Add), making available em(all) components of that partition.
Since tt(:Utility) already imports tt(<sstddef> :Add) can also use
tt(size_t). For tt(:Add) the tt(:Utility) partition wouldn't have to specify
tt(export) in front of tt(import <stddef>) since all components of imported
partitions are available to both the module and its partitions. But by using
tt(export import <cstddef>) users of the tt(Math) module automatically receive
tt(<cstddef>'s) definitions (among which tt(size_t)). Here's the tt(Math::Add)
partition interface unit (again: notice that the interface doesn't contain an
export compound):
verbinsert(-as4 examples/partition/math/add/modadd.cc)
For this partition no members were defined inline (although that would also
have been possible). Instead all members were defined in separate source
files. Here is tt(class Add's) constructor:
verbinsert(-as4 examples/partition/math/add/add1.cc)
and its tt(sum) member:
verbinsert(-as4 examples/partition/math/add/sum.cc)
|