开发者

How to represent C++ new() operator using UML

I want know how to represent the C++ new() operator 开发者_如何学运维using UML Class Diagram. For example, if I have:

Class B
{
  ...
}

Class A
{
  void exampleMethod()
  {
    B *test = new B();
  }
}


You can depict it in the following way:

How to represent C++ new() operator using UML


The class diagram is a structural view of the system, so you won't normally see any representation of the behaviour of methods in it.

You can add it as body tag or comment depending on the tool, or associate a sequence diagram containing a «create» message with the method as Als suggests.


Using a class diagram you can use a directed associaton with the stereotype <<instantiate>>, see the following example:

How to represent C++ new() operator using UML

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜