"a class instantiates another" 是什么意思?
What does "a class instantiates another" mean?
来自 GoF 的设计模式:
Another useful thing to show is which classes instantiate
which others. We use a dashed arrowheaded line to indicate this,
since OMT doesn't support it. We call this the "creates"
relationship. The arrow points to the class that's instantiated. In
Figure B.lc, CreationTool creates LineShape objects.
这里的"a class instantiates another"是什么意思?
谢谢。
另一种表达方式是 "a class creates an instance of another",这样更明显。
这只是意味着 Class A
在其中创建了一个 Class B
的实例(或“Class A
实例化 Class B
”)。
例如,您可能有一个 Person
class,它创建了一个 Hand
class 的实例,然后使用它。
来自 GoF 的设计模式:
Another useful thing to show is which classes instantiate which others. We use a dashed arrowheaded line to indicate this, since OMT doesn't support it. We call this the "creates" relationship. The arrow points to the class that's instantiated. In Figure B.lc, CreationTool creates LineShape objects.
这里的"a class instantiates another"是什么意思?
谢谢。
另一种表达方式是 "a class creates an instance of another",这样更明显。
这只是意味着 Class A
在其中创建了一个 Class B
的实例(或“Class A
实例化 Class B
”)。
例如,您可能有一个 Person
class,它创建了一个 Hand
class 的实例,然后使用它。