由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 这道设计面试题这样解对吗
相关主题
[合集] 问几道amazon面试题大家看一下这道google面试题
问一个interview时候design的general问题谁能解释下这道c++的面试题
讨论:关于一个design 问题怎么做这道面试题?
Bloomberg offer全过程OO design 题一般思考的方向?
设计题目的本质问题谁还记得这道面试题吗?
1st Amazon phone interview (1hr)salesforce面试难度如何
我也来写个面经吧A家电面
请问设计一个虚拟的动物园,用什么设计模式好啊?问问谁会这道算法的面试题?
相关话题的讨论汇总
话题: car话题: color话题: vehicle话题: class话题: engine
进入JobHunting版参与讨论
1 (共1页)
S*******C
发帖数: 822
1
第二个是design problem 不用写代码,给 car Honda, color, engine, Vehicle(单车
也包括在内) drive.让写他们之间的关系。
写几句话就可以了。
____________
Vehicle is an interface which declares a method drive().
Car Honda is abstract class that extends Vehicle. Car also has engine and
color as member variable.
The relationship between Vehicle and Car is inheritance.
The relationship between engine/color and Car is composition.
p*****2
发帖数: 21240
2
composition 不是这个意思吧?

【在 S*******C 的大作中提到】
: 第二个是design problem 不用写代码,给 car Honda, color, engine, Vehicle(单车
: 也包括在内) drive.让写他们之间的关系。
: 写几句话就可以了。
: ____________
: Vehicle is an interface which declares a method drive().
: Car Honda is abstract class that extends Vehicle. Car also has engine and
: color as member variable.
: The relationship between Vehicle and Car is inheritance.
: The relationship between engine/color and Car is composition.

S*******C
发帖数: 822
3
那是aggregation?

【在 p*****2 的大作中提到】
: composition 不是这个意思吧?
n*******s
发帖数: 17267
4
I would think that car:engine association is composition but
Car:color association is aggregation.

【在 p*****2 的大作中提到】
: composition 不是这个意思吧?
g*****g
发帖数: 34805
5
color is an attribute of car.

【在 n*******s 的大作中提到】
: I would think that car:engine association is composition but
: Car:color association is aggregation.

n*******s
发帖数: 17267
6
That is my first understanding as well

【在 g*****g 的大作中提到】
: color is an attribute of car.
n*******s
发帖数: 17267
7
And the question is what is the relationship between
Class Car and Class Color, is it not aggregation?
n*******s
发帖数: 17267
8
By the word, it certainly does not feel like it is.
p*****2
发帖数: 21240
9
color is not a class
用oo不能教条呀
不是什么都是object的

【在 n*******s 的大作中提到】
: And the question is what is the relationship between
: Class Car and Class Color, is it not aggregation?

n*******s
发帖数: 17267
10
Color可以是class吧,不过这些乱七八糟的说法都是Booch那帮人瞎编的,
我也是真不清楚。

【在 p*****2 的大作中提到】
: color is not a class
: 用oo不能教条呀
: 不是什么都是object的

S*******C
发帖数: 822
11
The best way to define Color is enum.

【在 p*****2 的大作中提到】
: color is not a class
: 用oo不能教条呀
: 不是什么都是object的

1 (共1页)
进入JobHunting版参与讨论
相关主题
问问谁会这道算法的面试题?设计题目的本质问题
这道Amazon面试题怎么做1st Amazon phone interview (1hr)
这道雅虎的面试题绝了,有谁会做吗我也来写个面经吧
这道算法面试题怎么做?求一元一次方程的解请问设计一个虚拟的动物园,用什么设计模式好啊?
[合集] 问几道amazon面试题大家看一下这道google面试题
问一个interview时候design的general问题谁能解释下这道c++的面试题
讨论:关于一个design 问题怎么做这道面试题?
Bloomberg offer全过程OO design 题一般思考的方向?
相关话题的讨论汇总
话题: car话题: color话题: vehicle话题: class话题: engine