皮皮学,免费搜题
登录
搜题
【简答题】
Classes and Inheritance 1 Classes How are objects defined? An object is defined via its class,which determines everything about an object.Objects are individual instances of a class.A method is simply the action that a message carries out.It is the code,which gets executed when the message is sent to a particular object. Classes serve as templates from which objects can be created.C1asses have the same instance variables and operations as corresponding objects but their interpretation is different.Instance variables in an object represent actual variables while class instance variables are potential,being instantiated only when an object is created.We may think of a class as specifying a behavior common to all objects of the class.The instance variables specify a structure (data structure) for realizing the behavior.The public operations of a class determine its behavior while the private instance variables determine its structure.Private copies of a class can be created by a make-instance operation,which creates a copy of the class instance variables that may be acted on by the class operations.Syntactically,a class can be represented as: name:class instance variables ... class variables ... instance methods ... class methods ... Classes specify the behavior common to all elements of the class.The operations of a class determine the behavior while the instance variables determine the structure. 2 Inheritance In the world at large,it is often possible to arrange concepts into an inheritance hierarchy——a hierarchy in which each concept inherits the properties of the concept immediately above it in the hierarchy. For example, we might classify different kinds of vehicles according to the inheritance hierarchy in Figure 5-3. Moving down the hierarchy, each kind of vehicle is more specialized than its parent (and all of its ancestors) and is more general than its child (and all of descendants). A wheeled vehicle inherits properties common to all vehicles (it holds one or more people and carries them from place to place) but has an additional property that makes it more specialized (it has wheels). A car inherits properties common to all wheeled vehicles but also has additional, more specialized properties (four wheels, an engine, a body, and so forth). The inheritance relationship can be viewed as an is-a relationship.Every two-door car is a car,every car is a wheeled vehicle,and every wheeled vehicle is a vehicle. Inheritance allows us to reuse the behavior of a class in the definition of new classes.Subclasses of a class inherit the operations of their parent class and may add new operations and new instance variables. Inheritance captures a form of abstraction called super-abstraction, that complements data abstraction. Inheritance can express relations among behaviors such as classification, specialization, generalization, approximation, and evolution. The ability to classify classification of classes provides greater classification power and conceptual modeling power. Classification of classes may be referred to as second-order classification. Inheritance provides second-order sharing, management, and manipulation of behavior that complements first-order management of objects by classes. Syntactically, inheritance may be specified in a class as: name:class super class ... instance variables {as before}
拍照语音搜题,微信中搜索"皮皮学"使用
参考答案:
参考解析:
知识点:
.
..
皮皮学刷刷变学霸
举一反三
【单选题】什么命令可以重新安排已创建特征的次序?
A.
特征重新排序
B.
特征重新安排
C.
编辑时间戳记
D.
移动特征
【单选题】根据北魏的均田制,大部分国有土地授出后要求受田者年老身死时交还国家再分配,但这种“还”和“受”大多在户内进行。这说明均田制客观上
A.
抑制了土地兼并
B.
造成了国有土地的私有化
C.
加剧了皇权衰落
D.
促进了农业经济的发展
【单选题】听力原文:M: Do you always look over your own papers for typing mistakes? W: I usually have to do it myself, but I'd rather have someone else proofread them. Q: What would. the woman prefer to do? (13)
A.
Compare her own paper with others.
B.
Watch out for the usual typing mistakes.
C.
Have someone else type her paper.
D.
Ask another person to check her work.
【判断题】树脂、杉木、焦糖香等都属于咖啡的低挥发芳香物质。
A.
正确
B.
错误
【判断题】偿债问题就是未来收入现金流的资产现值不足以偿还实际负债余额。()
A.
正确
B.
错误
【简答题】简述动车转向架基本构成?
【简答题】Why do they go to school like this?
【简答题】不止一次地出现在大观园中的一个平凡劳苦、善良风趣的农村老妇人,常被大家取笑戏弄的人是 。
【简答题】What kind of products do the female shoppers like Zhang Jieyi mainly buy online? And Why do they go online
【单选题】不止一次地出现在大观园中的一个平凡劳苦的农家老妇,常被大家取笑戏弄的人是( )。
A.
刘姥姥
B.
板儿
C.
雪雁
D.
金钏儿
相关题目: