Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我们将树视为一个对象,那么它的叶子和树枝会是什么? 同样,如果我们把狗当作一个物体,那么它的腿、嘴巴和眼睛会是什么?
一棵树有一组分支。每个分支都有一组叶子。
即(伪代码)
class Tree { Branch[] branches; } class Branch { Leaf[] leaves; } class Leaf { }
狗也一样:狗有一组眼睛;它还有一组腿;它有一张嘴。
class Dog { Leg[] legs; Mouth mouth; Eye[] eyes; }