• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Sierra/Bates Ch 5 Self Test #5 (aggregation)

 
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
class C {}
class A { C c = new C(); }
class B extends A {}
Is there an aggregation from B to C? I think not. The relationship is between A and C.
In UML diagrams, when they draw an aggregation from one class A to another C, they do not draw an aggregation from the subclasses of A to C.
In the UML Reference Manual inheritance is a concept related to but distinct from the generalization relationship. Inheritance is a mechanism for combining shared incremental descriptions to form a full description of an element.
In the UML Reference Manual they say an aggregation relationship is transitive across all aggregation links. If A aggregates B and B aggregates C then A aggregates C. They do not say If A aggregates C and B extends A then B aggregates C.
[ April 17, 2003: Message edited by: Marlene Miller ]
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think this question is really about is-a and has-a. When I answered it, I mentally reworded it to ask "Does B have-a C?". The answer is yes, by inheritance from class A.
 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Barry Gaunt:
I think this question is really about is-a and has-a. When I answered it, I mentally reworded it to ask "Does B have-a C?". The answer is yes, by inheritance from class A.


Yep --the way Barry is thinking about it is *exactly* what the question is looking for.
In fact, on the real SCJP, we deliberately made the exam objectives for is-a and has-a no more precise than we did, because we are testing ONLY for whether you understand the fundamentals of is-a and has-a, period.
It is the high-level nature of those two relationships that matter. More fine-grained distinctions of composition and aggregation, and/or UMLspecifics are tested only by the Architect exam (and I think one of the IBM exams).
I'm going to open another topic in just a moment, though, because I *have* been seeing some confusion about just how deep and detailed the exam gets, especially in obscure areas of the spec (the exam does NOT), and I just want to make sure that newcomers here aren't becoming worried about the nature (and scope) of the exam. What *is* on the exam, and the way the questions are worded, is challenging enough as it is
cheers,
Kathy
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic