- 1
- 0
- 约 60页
- 2021-12-01 发布于安徽
- 举报
软件设计课件:Lecture04FundamentalsofOOPObjectandClass.
* * * * * * * * * * * * * * * * * * * * * * * The initial military time is 00:00 The initial standard time is 12:00:00 AM ? Military time after setTime is 13:27 Standard time after setTime is 1:27:06 PM ? After attempting invalid settings: Military time: 00:00 Standard time: 12:00:00 AM Program Output * Outline The evolution way to the Object Oriented technique Abstract Data Type Class Scope and Accessing Class Members Separating Interface from Implementation Controlling Access to Members Access Functions and Utility Functions Scope Accessing Class Members Class scope Data members and member functions File scope Nonmember functions Function scope Variables defined in member functions, destroyed after function completes Inside a scope Members accessible by all member functions Referenced by name Scope Accessing Class Members function scope local scope file scope function scope local scope Outside a scope Use handles An object name, a reference to an object or a pointer to an object Accessing class members Same as structs Dot (.) for objects and arrow (-) for pointers Example: t.hour is the hour element of t TimePtr-hour is the hour element Scope Accessing Class Members Assign 7 to x and print using the objects name: 7 Assign 8 to x and print using a reference: 8 Assign 10 to x and print using a pointer: 10 Program Output * Outline The evolution way to the Object Oriented technique Abstract Data Type Class Scope and Accessing Class Members Separating Interface from Implementation Controlling Access to Members Access Functions and Utility Functions Separating Interface from Implementation Separating interface from implementation Easier to modify programs C++ programs can be split into Header files – contains class definitions and function prototypes Source-code files – contains member function definitions Program Outline: Using the same Time class as before, create a header file Create a source code file Load the header file to get the class
您可能关注的文档
最近下载
- TCQFX001-2024四川省机动车维修工时定额标准.pptx VIP
- ASTM E92-2023中文版,维氏硬度试验.pdf VIP
- (2026春新版本) 部编版道德与法治三年级下册全册教学设计.docx
- Roland罗兰VM-3100PRO MIDI使用说明书.pdf
- Unit 3 American beginnings.ppt VIP
- 《英语国家社会与文化入门》Unit 3 American Beginnings.ppt VIP
- 吸痰技术操作考核评分标准.docx VIP
- 广东兴宁廖氏典型世系世之一.doc VIP
- 营口机场项目机场工程3.doc VIP
- “全国黄金交易从业水平考试”题库.docx VIP
原创力文档

文档评论(0)