Relationships between Classes

0

I am working on Class Diagram and my question is yes, a Class X can have 2 relations with a Class Y .

Let me explain : Class X can have inheritance and dependency with Class Y?

Is that what I mean, can this exist between two classes?

Thanks for the attention, the collaboration and the patience

    
asked by Kibō_B 09.03.2018 в 15:32
source

1 answer

0

Let's see if I understand your question correctly. Step to answer you:

You can inherit from a class X and in turn have attributes of that class X. An example (written in Java and C ++) would be the following:

Example in Java:

public class X{
[...]
}

public class Y extends X{
private X x;
[...]
}

Example in C ++:

class X{
[...]
};
class Y: public X{
private:
  X x;
[...]
}
    
answered by 09.03.2018 в 15:51