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 ...
随机推荐
- Bzoj 2346: [Baltic 2011]Lamp dijkstra,堆
2346: [Baltic 2011]Lamp Time Limit: 10 Sec Memory Limit: 256 MBSubmit: 428 Solved: 179[Submit][Sta ...
- usaco 安慰奶牛
Description 约翰有N个牧场,编号依次为1到N.每个牧场里住着一头奶牛.连接这些牧场的有P条 道路,每条道路都是双向的.第j条道路连接的是牧场Sj和Ej,通行需要Lj的时间.两牧场之 间最多 ...
- poj 2186 Popular Cows【tarjan求scc个数&&缩点】【求一个图中可以到达其余所有任意点的点的个数】
Popular Cows Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 27698 Accepted: 11148 De ...
- kafka consumer 分区reblance算法
转载请注明原创地址 http://www.cnblogs.com/dongxiao-yang/p/6238029.html 最近需要详细研究下kafka reblance过程中分区计算的算法细节,网上 ...
- 23讲 URL
这是看完23讲后的小笔记,关于URL规则.伪静态. 一.URL规则 2.此处的区分大小写,也只是对第一个字母区分,并非对整个模块名. 3.模块名复杂时,且区分大小写,此时在地址栏访问时要用" ...
- 保存网页MHT
uses ADODB_TLB, CDO_TLB, ComObj,MSHTML;{$R *.dfm}{能把网页如 WWW.QQ.COM保存为一个单文件 .MHT但不能把一个 A.HTM 保存为一个单文件 ...
- 【NodeJs】用arrayObject.join('')处理粘包的错误原因
服务器测试代码如下: var net = require('net'); var server = net.createServer(function(c){ console.log('client ...
- Linux强制踢出登录用户(断线账户剔除)
首先,用w查看登录用户 :: up days, :, users, load average: 1.00, 1.01, 1.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU ...
- js常用笔记
此文仅为笔记,代码来源自网络 网络技术文档:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript 1.使用||和&&简化语句, ...
- mysql免安装版使用
打开命令行,到bin目录下,输入net start mysql 启动服务,输入mysql -u root -p回车后输入密码,进入mysql.