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.