What does "a class instantiates another" mean?

144 views Asked by At

From Design Pattern by 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.

enter image description here

What does "a class instantiates another" mean here?

Thanks.

1

There are 1 answers

3
samanime On BEST ANSWER

Another way to phrase it would be "a class creates an instance of another", which makes it a little more obvious.

It just means that Class A creates an instance of Class B inside of it (or "Class A instantiates Class B").

For example, you might have a Person class, which creates an instance of a Hand class, which it then uses.