Question

Given this pseudo code:

class B { }

class A : B
{
    int val;
};

alpha = new A();

What arrow do I draw between alpha and A in a UML class diagram? Is this even something UML is meant to do?

+-------+        +-------+        +-------+
| alpha | --??-- |   A   |------|>|   B   |
|       |        |       |        |       |
+-------+        +-------+        +-------+

In my case, I truly do want to express explicitly that alpha instantiates A. So if there is no way in UML, I'll just make up a way -- which is fine, but I want to know if UML can express it already. My situation is that I'm trying to explain OOP to a friend who is very visual. Therefore, I want to try to visually distinguish the two relationships (inheritance and instantiation) so that he can distinguish it mentally.

No correct solution

Licensed under: CC-BY-SA with attribution
scroll top