简体   繁体   中英

Is the composition relationship correct between a class and an enumeration?

Because the unique instances of an enumeration lives during all the lifecycle of the application, I can say that there will be no composition relationship between a class and an enumeration.

在此处输入图片说明

Is what I say correct ?

No. That is simply contra-dictionary/nonsense. An enum is just one out of many. A composition is (as the name says) composed of multiple things. What you need here is a simple dependency which goes from MyClass to MyEnum . Not more.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM