简体   繁体   English

类和枚举之间的构成关系正确吗?

[英]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 . 您需要的是从MyClassMyEnum的简单依赖MyEnum Not more. 不多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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