473,466 Members | 1,413 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Mapping Class Diagram to C++ coding

My question is regarding the mapping of Class diagram to the C++
coding.

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
objB.funB(objA);
}

-----------------------------------------------------
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.
CAR

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
called)

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

COMPOSITION and AGGREGATION is only left that in aggregation the
aggregated

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

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

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
is

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

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

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

May 2 '07 #1
1 4662
On May 2, 1:12 pm, Jennifer Jazz <Jeniffer...@gmail.comwrote:
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

May 2 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jacqueline Snook | last post by:
Hi, I am working on a website that uses a SVG diagram with multiple polygons (to represent rooms in a hotel). Each polygon has a class to represent whether the room is single or double. In a...
0
by: Sebastian Ware | last post by:
O/R Mapping. After six months of hard work, we are proud to make available the Public Beta of Pragmatier Data Tier Builder 2.5. Initial feedback is amazing, download NOW and find out for yourself:...
5
by: A.M | last post by:
Hi, I am looking for a Diagram that visually shows how System.Web.HttpApplication class contains System.Web.UI.Page classes and how they interact together. I am trying to underestand the class...
1
by: alex | last post by:
Moving existing asp.net 1.1 app to 2.0 and using VS2005 I have noticed: 1) Class View window display ONLY name spaces and classes located in the new folder App_Code. 2) Using "Add New Item" on...
4
by: thoducng | last post by:
Hi all: I want to create a class diagram, similar to MFC class diagram published long ago. I don't need a UML model, all I need is a class named and inheritance relationship. My classes are in...
3
by: Lee Crabtree | last post by:
Are there any tools that will take an existing assembly and generate a class hierarchy from it? It seems like the kind of thing that would be possible with reflection, but I don't know enough...
2
by: José Joye | last post by:
Hello I'm currently looking for a diagram that shows the event we can register with asp.net. I'm currently a bit lost with when they are fight and which one are our disposal..... Thanks,...
5
by: Flak | last post by:
Hi, I am a beginning to intermediate PHP programmer. Home schooled. My programmes are starting to get rather big with a couple of thousand lines of code and 10's of different files. I am...
1
by: Jennifer Jazz | last post by:
My question is regarding the mapping of Class diagram to the C++ coding. There are 3 realtions in Class diagram 1) Assosication 2) Composition 3) Aggregation (Weak Composition). ...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.