- 1、本文档共26页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Writing a Good Program 5. Objects and Classes in C++.ppt
Acknowledgment The slides are based on the set developed by Dr. Frank Leung (EIE). * * Writing a Good Program 5. Objects and Classes in C++ 5.1 Basic Object Oriented Programming Computer Programming and Basic Software Engineering 5. Objects and Classes in C++ What is an Object? The real world is composed of different kinds of objects: buildings, men, women, dogs, cars, etc. Each object has its own states and behaviors. Color = Red Brand = Ferrari Speed = 200 mph Gear = 4 States Braking Accelerating Changing Gear Steering Behaviors Computer Programming and Basic Software Engineering 5. Objects and Classes in C++ Variables and functions What is a Software Object? Software designers use the same idea to ease programmers to develop their software Software is also composed of different kind of software objects Each software object also has its own states and behaviors. Variables (States) Color = Grey Size = 2cm x 2cm Shape = Rectangular Method (Behavior) (protruded) Press( ) Computer Programming and Basic Software Engineering 5. Objects and Classes in C++ Button Encapsulation Hiding information within an object’s nucleus Provide a public interface for interacting with it Advantages to software developers Modularity: An object can be easily passed around in the system (Otherwise, you need to think about how many files you need to bundle together to pass to your friends) Information hiding: Users need not go into details of the object before using the object (E.g., you don’t need to know the circuit of a TV set if you want to watch TV) Safety: Users of the object may not directly access the internal state of the object. This reduces the possibility of erroneous situations. Computer Programming and Basic Software Engineering 5. Objects and Classes in C++ Library Reusability Objects of class button What is a Class? A Class is a blueprint or prototype that defines the variables and methods common to all objects of a certain kind Every object of
您可能关注的文档
- TA08Architectural comparison of virtualization technologie.PPT
- Taipei City- In the Eyes of A Flaneur.ppt
- Taipei Taxi.ppt
- Taiwan - 中华民国期刊论文资料库-RefWorks.ppt
- Taiwan - 中文图书资讯学文献摘要资料库 (CLISA)-RefWorks.ppt
- Taiwan - 中文电子期刊服务(CEPS)-RefWorks.ppt
- Taiwan Semiconductor Manufacturing Company.ppt
- TAM3000光电缆路由探测仪.ppt
- TANet竹苗区网研习课程网路安全系列 电脑网路病毒防治.ppt
- tang3hu1xi1zhong3 gu3 zhe2gu4gai4 hu4 ji2.ppt
文档评论(0)