皮皮学,免费搜题
登录
搜题
【简答题】
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}
拍照语音搜题,微信中搜索"皮皮学"使用
参考答案:
参考解析:
知识点:
.
..
皮皮学刷刷变学霸
举一反三
【简答题】汽车排放的污染物主要有()、HC、()、微粒物及硫化物等。
【单选题】下列哪项不是引起肝性脑病的毒性物质
A.
羟苯乙醇胺
B.
苯乙醇胺
C.
多巴胺
D.
5-羟色胺
E.
短链脂肪酸
【单选题】下列哪项不是引起肝性脑病的有毒物质( )
A.
硫醇
B.
短链脂肪酸
C.
钾、镁离子
D.
氨分子
E.
芳香族氨基酸
【单选题】汽车排放的污染物主要有一氧化碳、碳氢化合物、氮氧化合物和( )
A.
B.
氧气
C.
微粒
D.
氮气
【多选题】题名途径指通过文献的题名来查找文献的途径,主要包括( )。
A.
文献的篇名
B.
书名
C.
刊名
D.
数据库名
【单选题】下列哪项不是引起肝性脑病的毒性物质
A.
羟苯乙醇氨
B.
苯乙醇氨
C.
多巴胺
D.
5-羟色氨
【多选题】题名途径指通过文献的题名来查找文献的途径,主要包括( )。
A.
文献的篇名
B.
书名
C.
刊名
D.
数据库名称
【简答题】“众”表示“许多(人)”,“磊”形容“石头很多”。这时采用了哪种造字法?请再举出5例。
【单选题】下列哪项不是引起肝性脑病的毒性物质:
A.
苯乙醇胺
B.
羟苯乙醇胺
C.
短链脂肪酸
D.
多巴胺
【单选题】下列哪项不是引起肝性脑病的毒性物质?
A.
羟苯乙醇胺
B.
苯乙醇胺
C.
多巴胺
D.
吲哚
E.
短链脂肪酸
相关题目: