类别和项目之间的关系 [英] relationship between a category and a item

查看:99
本文介绍了类别和项目之间的关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计们,



这似乎是一个微不足道的问题,但是当我对它有很多想法时,它会让我的大脑震惊。



IS-A 类别列出的东西或 HAS-A 类别的东西列表?

我和我的同事根本不确定如何正确回答这个问题。



经过讨论,我们认为两者都是对的,但我们不是100%肯定。



我认为一个类别就像一个盒子是正确的。您可以放入一些字母,关闭盒子并将盒子放入机架。所以盒子里面的类别的字母。

但是b
我认为你也可以说你把字母放在堆栈上stack 类别。



和机架一样。

机架可以有一个清单盒子

但是
架子可以包装盒子



我知道它有点令人困惑。



但我希望有人可以写下他的观点并指出原因。

Hey guys,

this seems to be a trivial question, but it blows away my brain when i'm thought a lot about it.

IS-A category a list of things or HAS-A category a list of things?
Me and my co-worker aren't sure at all how to answer the question correctly.

After discussion we are thinking both is right but we aren't 100% sure.

I think it is right to say a category is like a box. You can put in some letters, close the box and put the box into a rack. So the box has letters of a category inside.
BUT
I think you could also argument that you put the letters on a stack and the stack is the category.

And the same thing with the rack.
The rack could have a list of boxes
BUT
The rack can consists of boxes

I know it's a little bit confusing.

But i hope someone could write down his perspective and point out why.

推荐答案

IS-A表示继承,例如猫是动物。



HAS-A表示组成,例如猫有一条腿。
IS-A denotes inheritance e.g. cat is-a animal.

HAS-A denotes composition e.g. cat has-a leg.


这篇关于类别和项目之间的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆