F
Frederik Vanderhaegen
Hi,
Can anyone explain me the difference between aggregation and composition?
I know that they both are "whole-part" relationships and that composition
parts are destroyed when the composition whole is destroyed.
Under a "whole-part" relationship I understand the following:
the whole can't exists without the parts, but can the parts exist without
the hole?
f.e.: a car can't exist without an engine
private engine _Engine
public car(engine oEngine){
this._Engine=oEngine
}
but, is it possible to create an engine without that a car has been
created?
Is it possible to provide me a code sample because I don't have a clue how
to implement this and a sample says more than a 1000 words.
Please correct me if I'm wrong.
Thanks in advance
Frederik
Can anyone explain me the difference between aggregation and composition?
I know that they both are "whole-part" relationships and that composition
parts are destroyed when the composition whole is destroyed.
Under a "whole-part" relationship I understand the following:
the whole can't exists without the parts, but can the parts exist without
the hole?
f.e.: a car can't exist without an engine
private engine _Engine
public car(engine oEngine){
this._Engine=oEngine
}
but, is it possible to create an engine without that a car has been
created?
Is it possible to provide me a code sample because I don't have a clue how
to implement this and a sample says more than a 1000 words.
Please correct me if I'm wrong.
Thanks in advance
Frederik