Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Mapping Class Diagram to C++ coding

Thread Tools

Mapping Class Diagram to C++ coding

Jennifer Jazz
Posts: n/a
My question is regarding the mapping of Class diagram to the C++

There are 3 realtions in Class diagram

1) Assosication
2) Composition
3) Aggregation (Weak Composition).

Class diagram for A ----- B (Association)
I handle it coding like that

main() {
A objA;
B objB;

objA.funA(objB); // or

A <>---- B (filled diamond) for compoistion
Take the example of CAR and ENGINE, this relation is composition

I handle it coding like that

class B {
class A {
B objB; //or B* objB

This shows when A's Object destroys B also destroys.
Im clear with above two concepts but when aggregation comes.

A <>---- B (non-filled diamond) for agregation
Take the example of CAR and WHEEL-CUP.

class B {
class A {
B* ptrB;

Take the example of CAR and WHEEL-CUP, this relation is aggregation.

changes its wheel-cup each time when it go to service the car.

CAR <>------ Wheel-CUp

im not getting one thing thing when car destroyed (i.e. destructor

does Wheel-Cup should also destroy? iF yes then the difference

COMPOSITION and AGGREGATION is only left that in aggregation the

object (B* ptrB) points to different objects i.e. different wheel cups

different states. and in COMPOSITION it only keep points to only one

AND in both aggre. and comp. object B destoys as object A destroys.

One more question , in composition the Object B is created as object A

created i.e. (When CAR is created ENGINE also created) but what abt

cups? when they will be created and destroyed? as wheel cups can

independly and when car goes for services, they new wheel cups only
points of

the this car showing new wheel cups attached. So the other wheel cups

destroyed !!??

I shall be very very thankful if u answer me this question

Reply With Quote
Posts: n/a
On May 2, 1:12 pm, Jennifer Jazz <(E-Mail Removed)> wrote:
> My question is regarding the mapping of Class diagram to the C++
> coding. [snip]

See your other posting of this question for my answer.

Cheers! --M

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
general coding issues - coding style... calmar Python 11 02-21-2006 10:36 AM
Mapping of source code to UML class diagram verma Computer Support 0 12-20-2005 04:26 AM
UMG diagram mapping to source code verma Computer Support 0 12-20-2005 04:22 AM
Nested Class, Member Class, Inner Class, Local Class, Anonymous Class E11 Java 1 10-12-2005 03:34 PM
tool to make a class diagram from csharp Piero Massari ASP .Net 1 06-17-2004 09:14 PM