Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 220
  • Last Modified:

Can you tell all most fundamental relationship between classes?

like association Ageneralization so on.
can you give me the difining and examples of the relationships?
the example is decribed with c++!
thanks!
0
cococut
Asked:
cococut
  • 8
  • 3
1 Solution
 
AxterCommented:
Sounds like homework......
0
 
madfaceCommented:
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
 
cococutAuthor Commented:
to  madface ,can you give me the difining of the relationship and send the diagrams to me ?
why is'nt dependency included?
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
madfaceCommented:
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
 
cococutAuthor Commented:
but if like this:
class A;
class constrainA
{
  list<A> m;
};
class c
{
  constrainA n;
}
can we say c dependency a?

0
 
cococutAuthor Commented:
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
 
cococutAuthor Commented:
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
 
cococutAuthor Commented:
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
 
cococutAuthor Commented:
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
 
cococutAuthor Commented:
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
 
madfaceCommented:
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
 
cococutAuthor Commented:
thanks!madface!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 8
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now