What is "aggregate"

Just got an error that says "union __anonymous can only be part of an aggregate". I am not very puzzled by this because I was trying something that I knew should not work.

But it makes me wonder what the exact definition is for "collection" in D. I am assuming that it is a type that may contain other types such as array, structure or class. Or is it not so yet?

+3


source to share


2 answers


An aggregate is a structure or class. The idea is that you cannot have an anonymous union as a local or global variable, only as part of an object.



+4


source


I believe that in this context "collection" is used in relation to an instance-level relationship. In UML terms: http://en.wikipedia.org/wiki/Class_diagram#Aggregation . Thus, in simplest terms, "collection" means a member of a user-defined type that is of some other user-defined type (thus establishing a special "link" between two user-defined types).



+1


source







All Articles