- 3
- 0
- 约7.8千字
- 约 25页
- 2016-11-27 发布于河南
- 举报
abstractDataType
Abstract Data Type Summary A class can be used not only to combine data but also to combine data and functions into a single (compound) object. A member variable or function may be either public or private It can be used outside of the class when it’s public It can only be used by other member functions of the same class when it’s private An object of a class can be copied by “=“, memberwise copy (for static classes) ‘const’ is part of the function definition A constructor is a member function called automatically when an object is declared Each class has to have at least one constructor Constructors can be overloaded as long as the argument lists are different What is an abstract data type? A data type consists of a collection of values together with a set of basic operations on these values A data type is an abstract data type if the programmers who use the type do not have access to the details of how the values and operations are implemented. All pre-defined types such as int, double, … are abstract data types An abstract data type is a ‘concrete’ type, only implementation is ‘abstract’ Abstract Data Type An Abstract Data Type is a class with some special restrictions. These restrictions can make programming easier. One of these restrictions is called information hiding, used as black boxes, hide the implementation details In information hiding, the user should not be allowed to access the data members directly (they should be private). An Abstract Data Type is used in Object-Oriented Programming. How to do it in C++ with classes? Make all the member variables private ? private data (implementation details) Make member functions public ? public interface Separate the public interface from implementation, If you change the implementation, you don’t need to change the other parts of the programmes. Multiplication Division Rational Review Rational number Ratio of two integers: a/b Numerator over the denominator S
您可能关注的文档
最近下载
- 制造业信息化战略规划实施与优化-PDM.docx VIP
- 那智不二越机器人flexgui toolbox操作说明书.pdf VIP
- 智慧工厂-智慧工厂解决方案.docx VIP
- 高中化学解题方法归纳:和量法.doc VIP
- 译林牛津新版高中英语(必修1-3)单词表.pdf VIP
- 包装有限公司分切机安全风险分级清单.docx VIP
- 重庆市西南大学附属中学2025届高三下学期二诊模拟考试物理试卷 含解析.docx VIP
- 【高中英语】《星火英语同步词汇》抗遗忘速记手册.docx VIP
- 成都市锦江区2026届初三一诊(暨期末考试)数学试卷(含答案).docx
- 三坐标 培训教程.pptx VIP
原创力文档

文档评论(0)