@w1024020103
2017-03-27T23:34:02.000000Z
字数 1344
阅读 638
CS61B
搞清楚ADT这个概念
An abstract class is a generalization concept. It is a class you invent to only use as a base class for inheritance but not to instantiate objects from.
And abstract datatype (ADT) is not necessarily an OOP concept. It is an older term to describe the concepts of for example Stack and Queue in terms of their functionality, without describing the implementation.
Design a ParkingLot package that allocates specific parking spaces to cars in a smart way. Decide what classes you’ll need, and design the API for each. Time permitting, select data structures
to implement the API for each class. Try to deal with annoying cases (like disobedient humans).
ENUM class car:{regular, compact, handicapped}
class space:
public space spaceToPark(Type car);
public void markFree(Type car);
priority queue;(closer to the entrance is the prioriry)
感觉这道题现在不想做,写出来的答案跟参考答案差得远,但又不是全错,要怎么练习才能加强自己构造ADT的能力呢?