Book a Demo

Author Topic: Shared aggregations  (Read 6341 times)

frankk

  • EA User
  • **
  • Posts: 96
  • Karma: +0/-0
    • View Profile
Shared aggregations
« on: April 30, 2008, 01:27:43 am »
I have a hierarchy of classes starting from, say, A. Below A are two subclasses, B and C. B is an aggegation of D, E and F. C is also an aggregation of D, E and F. Is there a clean way to show that B and C both aggregate D, E and F, i.e., without duplicating D, E and F explicitly?

(P.S.: How do I upload/insert/attach diagrams?)

thomas.kilian

  • Guest
Re: Shared aggregations
« Reply #1 on: April 30, 2008, 02:31:47 am »
I don't see the problem here. You will simply have association links with aggregates from D, E and F to B and C.

You can attach pictures to any web location (there are providers to store pictures; there's a thread here which links to one pre-set provider but I forgot where).
Use Neil's link below. That's working pretty neat.
« Last Edit: April 30, 2008, 05:20:46 pm by thomas.kilian »

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Shared aggregations
« Reply #2 on: April 30, 2008, 09:06:41 am »
Quote
You can attach pictures to any web location (there are providers to store pictures; there's a thread here which links to one pre-set provider but I forgot where).
I use http://www.imageshack.us/. I have no idea if it's better or worse than any other image hosting site, but it's free and you can link to pictures directly.
The Sparx Team
[email protected]

Torsten Binias

  • EA User
  • **
  • Posts: 31
  • Karma: +0/-0
    • View Profile
Re: Shared aggregations
« Reply #3 on: May 04, 2008, 04:19:55 pm »
Hi,

why doesn't A then aggregate D, E and F?

    +-----+        +-----+
     !     !<>------!  D  !
     !     !        +-----+
     !     !        
     !     !        +-----+
     !  A  !<>------!  E  !
     !     !        +-----+
     !     !
     !     !        +-----+
     !     !<>------!  F  !
     +-----+        +-----+
        ^
       / \
       ---
        !
        !
   +----+-----+
   !          !
+-----+   +-----+
!  B  !   !  C  !
+-----+   +-----+


Best regards,
Torsten

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Shared aggregations
« Reply #4 on: May 05, 2008, 10:00:30 pm »
Sorry Torsten, but I'm not sure I get the question.

Do you mean "why don't B and C aggregate D, E, and F?"

If so, could it be a visibility setting? Perhaps you have the appropriate attributes of A set to private instead of protected. Or perhaps you need to explicitly define the attributes - I think there's an ongoing thread about this case.

David
No, you can't have it!

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Shared aggregations
« Reply #5 on: May 06, 2008, 12:42:18 am »
David,

I think Torsten simply wanted to ask why frankk wants to have the three associations in both derived classes B and C, and not define them on the base class A.

A reason for this could be that other classes without these associations are to inherit from A, and a language without multiple inheritance capability is being used.

This does not mean that I understand the original problem.

Frank

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Shared aggregations
« Reply #6 on: May 06, 2008, 01:26:26 am »
Yup,

That's about where I came in...

David
No, you can't have it!

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Shared aggregations
« Reply #7 on: May 06, 2008, 10:04:22 am »
Torsten's post may have been worded as a question, but I think it was intended as the answer (correct, IMO) to the original question "Is there a clean way...?"
The Sparx Team
[email protected]

Torsten Binias

  • EA User
  • **
  • Posts: 31
  • Karma: +0/-0
    • View Profile
Re: Shared aggregations
« Reply #8 on: May 09, 2008, 10:39:09 pm »
Hello,

yes, I tried to give an answer to the original question. Didn't mean to confuse everbody... :-)

Quote
A reason for this could be that other classes without these associations are to inherit from A, and a language without multiple inheritance capability is being used.

If that is the case then A can have a superclass from which those other classes can be derived.

Best regards,
Torsten