- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Classes and Data Abstraction.PPT
Classes and Data Abstraction Andrew Davison Noppadon Kamolvilassatian Department of Computer Engineering Prince of Songkla University Contents 1. What is Data Abstraction? 2. C++: Classes and Data Abstraction 3. Implementing a User-Defined Type Time with a Struct 4. Implementing a Time Abstract Data Type with a Class 5. Classes as User-Defined Types 6. Using Constructors 1. What is Data Abstraction? Abstract Data Types (ADTs) type implementation operations hidden implementation types are central to problem solving a weapon against complexity built-in and user-defined types are ADTs Clients and Manufacturers Benefits Manufacturer Benefits: easy to modify, maintain profitable reusable Client Benefits: simple to use, understand familiar cheap component-based How Well are ADTs Supported in C? Does C enforce the use of the ADTs interface and the hiding of its implementation? No C++ (Chapters 15-21) C++ is a superset of C, which has added features to support object-oriented programming. C++ supports classes. things very like ADTs 2. C++: Classes and Data Abstraction C++ supports Object-Oriented Programming (OOP). OOP models real-world objects with software counterparts. OOP encapsulates data (attributes) and functions (behavior) into packages called objects. Objects have the property of information hiding. Objects communicate with one another across interfaces. The interdependencies between the classes are identified makes use of a part of a specialisation of a generalisation of etc C and C++ C programmers concentrate on writing functions. C++ programmers concentrate on creating their own user-defined types called classes. Classes in C++ are a natural evolution of the C notion of struct. 3. Implementing a User-Defined Type Time with a Struct // FIG16_1.CPP // Create a structure, set its members, and print it. #include iostream.h struct Time { // structure definition int hour; // 0-23 int minute; // 0-59 int second; // 0-59 }; void printMi
您可能关注的文档
- Boom Town.ppt
- Boundary Layer Analyses.ppt
- Bureau of Foreign Trade, MOEA Mar.16, 2010.PPT
- Business Reference.ppt
- by Eddy RempelMay 13, 2005 SOSGSSD 2005.ppt
- by Rong Xiaohuafrom Dagang Middle School.ppt
- byJiazhi Ou jzou@cs.cmu.eduTal Blum blum@cs.cmu.edu.ppt
- C++语言程序设计第十六章.ppt
- C20.0046 Database Management SystemsLecture #18.ppt
- Cal State Northridge.ppt
- CMSC 414Computer and Network SecurityLecture 14.ppt
- Collaborative Spaces.ppt
- Common Services Centres (CSC) .ppt
- Comorbidity of Alcohol and Psychiatric Problems.ppt
- COMP 14 Computer Science, Robotics, Artificial Intelligence.ppt
- Comp 14Introduction to Programming.ppt
- COMP 361 – “Networks I” Spring 2005last revised 140205.ppt
- Comparability Protocols.ppt
- Comparators.ppt
- Compliance Assurance and Title V Monitoring.ppt
文档评论(0)