皮皮学,免费搜题
登录
logo - 刷刷题
搜题
【简答题】
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}
手机使用
分享
复制链接
新浪微博
分享QQ
微信扫一扫
微信内点击右上角“…”即可分享
反馈
参考答案:
举一反三
【单选题】某企业当期应缴纳的增值税为120000元,当期应缴纳的营业税、消费税、资源税、城市维护建设税分别为12000元、2000元、22000元、24000元,则反映在该企业当期利润表上的"营业税金及附加"项目的金额应为()元。
A.
180000
B.
60000
C.
14000
D.
38000
【单选题】对《中小学教师职业道德规范》规定的教师为人师表内容不概括( )
A.
教师的行为示范
B.
教师的语言示范
C.
教师的举止、仪表示范
D.
教师的钱财示范
【判断题】单片机应用系统硬件设计时,应考虑存储器、I/O接口、输入/输出通道、人机界面、通信电路的扩展,还应该考虑印刷电路板设计制作、负载容限、信号逻辑电平兼容性、电源系统的配置、抗干扰的实施等方面。( ) 【参考答案】单片机应用系统硬件设计时,应考虑存储器、I/O接口、输入/输出通道、人机界面、通信电路的扩展,还应该考虑印刷电路板设计制作、负载容限、信号逻辑电平兼容性、电源系统的配置、抗干扰的实施等方面。
A.
正确
B.
错误
【多选题】下列关于举止得体的具体要求的说法中,正确的有{.XZ}。
A.
态度恭敬
B.
表情热烈
C.
形象庄重
D.
行为适度
E.
动作夸张
【多选题】下列关于举止得体的具体要求的说法中,正确的有
A.
态度恭敬
B.
表情热烈
C.
形象庄重
D.
行为适度
E.
动作夸张
【多选题】以下哪些选项属于通信系统硬件检查的项目?()
A.
设备标志
B.
印刷电路板的各种规格
C.
设备的各种选择开关
D.
设备的各种保险丝
E.
列架、机架的接地
【单选题】下列哪类患者有跌倒、坠床的危险
A.
步态不稳者
B.
头痛、头晕,血压不稳者
C.
意识,精神障碍者
D.
使用毒、麻、精神类药物者
E.
以上均是
【单选题】可分泌淀粉消化酶的是
A.
口腔
B.
C.
肝脏
D.
大肠
【单选题】企业当期应缴纳的增值税为54 000元,当期交纳的消费税、资源税、城市维护建设税分别为5 000元、8 500元、6 810元,则反映在利润表上的税金及附加项目的数额应为( )元。
A.
74 310
B.
20 310
C.
13 500
D.
53 400
【多选题】依照《安全生产法》的规定,国务院负责安全生产监督管理的部门和县级以上地方人民政府负责安全生产监督管理部门的主要职责包括( )。
A.
依法对有关安全生产的事项进行审批、验收
B.
对违反安全生产法律、法规的行为依法实施行政处罚
C.
依照国务院和地方人民政府规定的权限组织生产安全事故的调查处理
D.
指导、协调和监督各级人民政府有关部门负责的安全生产监督管理工作
E.
依法对生产经营单位执行有关安全生产的法律、法规和国家标准或者行业标准的情况进行监督检查
相关题目:
参考解析:
知识点:
题目纠错 0
发布
创建自己的小题库 - 刷刷题