Data Abstraction
What is an object? (Page 238)
In C++, an object is just a variable, and the purest definition is "a region of storage" (this is a more specific way of saying, "an object must have a unique identifier," which in the case of C++ is an unique memory address). It's a place where you can store data, and it's implied that there are also operations that can be performed on this data.
Empty structure in C++ (Page 241)
In C, the empty structure is illegal, but in C++ we need the option of creating a struct whose sole task is to scope function names, so it is allowed. So structures with no data members will always have some minimum nonzero size.
Header file etiquette
What you can put into header file. (Page 244-245)
The basic rule is "only declarations," that is, only information to the compiler but nothing that allocates storage by generating code or createing variables.
The second header-file issue is this: when you put a struct declaration in a header file, it is possible for the file to be included more than once in a complicated program. Both C and C++ allow you to redeclare a function, as long as the two declarations match, but neither will allow the redeclaration of a structure. We can use the preprocessor directives "#define #ifdef #endif" to solve the problem.
Global scope resolution (Page 253)
::
If you want use a global variable in a function, but there is a same named variable in the function. The compiler would default to choosing the local one. So you can specify a global name using scope resolution "::".
Data Abstraction的更多相关文章
- 1.2 Data Abstraction(算法 Algorithms 第4版)
1.2.1 package com.qiusongde; import edu.princeton.cs.algs4.Point2D; import edu.princeton.cs.algs4.St ...
- Clean Code – Chapter 6 Objects and Data Structures
Data Abstraction Hiding implementation Data/Object Anti-Symmetry Objects hide their data behind abst ...
- three levels of abstraction
DATABASESYSTEM CONCEPTS SIXTH EDITION Abraham Silberschatz Yale University Henry F. KorthLehigh Univ ...
- Objective-C Data Encapsulation
All Objective-C programs are composed of the following two fundamental elements: Program statements ...
- 设计模式之里氏代换原则(LSP)
里氏代换原则(Liskov Substitution Principle, LSP) 1 什么是里氏代换原则 里氏代换原则是由麻省理工学院(MIT)计算机科学实验室的Liskov女士,在1987年的O ...
- 深入Java核心 Java中多态的实现机制(1)
在疯狂java中,多态是这样解释的: 多态:相同类型的变量,调用同一个方法时,呈现出多中不同的行为特征, 这就是多态. 加上下面的解释:(多态四小类:强制的,重载的,参数的和包含的) 同时, 还用人这 ...
- 【DB】database introduction
database applications: – Banking System,– Stock Market,– Transportation,– Social Network,– Marine Da ...
- Expression Tree Basics 表达式树原理
variable point to code variable expression tree data structure lamda expression anonymous function 原 ...
- 代码规范、GitHub提交源码的标准 答题人-杨宇杰
1.格式与命名规范1.1 缩进 使用Tab缩进,而不是空格键1.2 换行 每行120字符 if,for,while语句只有单句时,如果该句可能引起阅读混淆,需要用" {"和&quo ...
随机推荐
- NOI2007 货币兑换
[问题描述] 小 Y最近在一家金券交易所工作.该金券交易所只发行交易两种金券:A纪念券(以下简称A券)和B纪念券(以下简称B券).每个持有金券的顾客都有一个自己的 帐户.金券的数目可以是一个实数.每天 ...
- 1109 html5 xhtml;
XHTML 是 XML 风格的 HTML 4.01. HTML5 是下一代 HTML,取代 HTML 4.01. XHTML是基于XML发布的HTML规范,旨在规范HTML的格式. 两者提出的目的是不 ...
- MVC母版面,子页的脚本生成在最后
- xutils Error:(37, 39) 错误: 无法访问HttpRequestBase 找不到org.apache.http.client.methods.HttpRequestBase的类文件
Android 6.0(api 23)SDK已经强制移除httpclient 解决方案: 1降低api 2build.gradle中添加一句话 android { useLibrary'org.apa ...
- 微信小程序正式发布!这是最全的上手指南
2017 年 1 月 9 日,是一个值得载入互联网史册的日子. 这一天,零点刚过,张小龙和他的团队,在夜色笼罩下,正式发布了微信小程序. 所以,从这一刻开始,只要有开发者登录小程序后台,并在「开发管理 ...
- Python自动化之session
request.body 所有请求内容的原生数据 request.META 所有请求头的原生数据 cookie返回存在于响应头里面 session session是保存在服务端的键值对 cookie和 ...
- CAS+SSO原理浅谈
http://www.cnblogs.com/yonsin/archive/2009/08/29/1556423.htmlSSO 是一个非常大的主题,我对这个主题有着深深的感受,自从广州 UserGr ...
- div 水平居中
对需要水平居中的DIV层添加以下属性: margin-left: auto; margin-right: auto;
- 用apache的httpclient发请求和接受数据
此处发请求的是用httpclient4,请自己下载所需要的jar包. 发post请求,并得到数据. String url = "http://localhost:8080/lee" ...
- 通过源码看android系列之AsyncTask
整天用AsyncTask,但它的内部原理一直没有特意去研究,今天趁着有时间,码下它的原理. 具体用法就不再说明,相信大家已经用得很熟练了,我们今天就从它怎么运行开始说.先新建好我们的AsyncTask ...