Solved

Can you tell all most fundamental relationship between classes?

Posted on 2002-03-06
12
212 Views
Last Modified: 2010-04-01
like association Ageneralization so on.
can you give me the difining and examples of the relationships?
the example is decribed with c++!
thanks!
0
Comment
Question by:cococut
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 3
12 Comments
 
LVL 30

Expert Comment

by:Axter
ID: 6846123
Sounds like homework......
0
 
LVL 1

Expert Comment

by:madface
ID: 6846145
Aggragation (spelling?)

B HAS A C
class C
{
};

class B
{
C myC;
};

Aggregation with multiplicty of 10
class A
{
};

class B
{
A myAs[10];
};

Aggregation with multiplicty of 0 or more using vector container

class A
{
};

class B
{
vector <A> myAs;
};

Generalization
X IS A Y

class Y
{
};

class X : public Y
{
};

Assocation
T Assocates with S

class S
{
};

class T
{
S* theS;
};

sorry my spelling sucks
this is easier to understand if i could show you the diagrams as well
0
 

Author Comment

by:cococut
ID: 6846168
to  madface ,can you give me the difining of the relationship and send the diagrams to me ?
why is'nt dependency included?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:madface
ID: 6846333
Dependencies are very weak relationships between 2 classes
so weak that they are not implemented as varibles but often implemented as parameters for methods
you see this alot in COM

A depends on B

class B
{
};

class A
{
bool
INeedToDoSomething(B aB);
}

do you have rose or ms visual modeler?
0
 

Author Comment

by:cococut
ID: 6846552
but if like this:
class A;
class constrainA
{
  list<A> m;
};
class c
{
  constrainA n;
}
can we say c dependency a?

0
 

Author Comment

by:cococut
ID: 6846585
now I summarise the relationships!
relationship 1:
aggregation,
class A;
class B;
class C
{
  A a;
  B *b;
};
wo can say that :
A and C is an unidirectional aggregation relationship,C owns A;
B and C is an unidirectional aggregation relationship,C shares B;

to madface :is it right what I said above?
0
 

Author Comment

by:cococut
ID: 6846594
relationship 2:
generalization
class A;
class B:public A
{};
we can say that
A is the generalization of B,
B is the specialization of A;
0
 

Author Comment

by:cococut
ID: 6846600
relationship 3:
dependency,
class A;
class B
{
  method(A& a);
};
we can say that
B depends on A

or

class A;
class constrainA
{
 list<A> m;
};
class C
{
 constrainA n;
}
we can say that
C depends on A



0
 

Author Comment

by:cococut
ID: 6846607
to madface:

now I am wonderfun that the association relaitonship,
if
class A;
class B
{
  A* a;
};
is A and B  an associatin or aggregation relationship?

another question is :
class A;
class B
{
  A* a;
};
class A
{
  B b;
};
which relationship A and B?
thanks!
0
 

Author Comment

by:cococut
ID: 6846774
to madface:

now I am wonderfun that the association relaitonship,
if
class A;
class B
{
  A* a;
};
is A and B  an associatin or aggregation relationship?

another question is :
class A;
class B
{
  A* a;
};
class A
{
  B b;
};
which relationship A and B?
thanks!
0
 
LVL 1

Accepted Solution

by:
madface earned 100 total points
ID: 6846894
sounds like you want to know more then basic bare bones uml impl.


check this site out it has what you need
http://www.holub.com/class/uml/uml.html
0
 

Author Comment

by:cococut
ID: 6849447
thanks!madface!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question