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 ...
随机推荐
- strcpy,memcpy,内存块重叠
前段时间准备面试,看了一些库函数的实现,在看到memcpy时,发现有处理source和destination所指内存有重叠的情况,而strcpy没有,特别模仿库函数写了这个函数,并进行了测试.以下是具 ...
- 三大跨平台网盘--dropbox
背景介绍 Dropbox是一个提供同步本地文件的网络存储在线应用.支持在多台电脑多种操作中自动同步.并可当作大容量的网络硬盘使用. 准备工作 帐号--dropbox官网 软件--windows/ubu ...
- Tornado源码探寻(开篇)
一.先从一个简单的socket说起 运行脚本并在浏览器上访问http://127.0.0.1:8080 #!/usr/bin/env python #coding:utf-8 import socke ...
- struts2 表单处理
在这篇教程里我们将探究如何处理表单提交.本文例子介绍: javabean存储表单数据 在action中重写validate方法进行简单的校验 创建一个struts2表单并和javabean匹配 jav ...
- MVC中一般为什么用IQueryable而不是用IList
IList(IList<T>)会立即在内存里创建持久数据,这就没有实现“延期执行(deferred execution)”,如果被加载的实体有关联实体(associations),此关联实 ...
- EasyUI-动态添加tab
layout效果 代码: <%@ page language="java" contentType="text/html; charset=utf-8" ...
- W5500问题集锦(持续更新中)
在"WIZnet杯"以太网技术竞赛中,有非常多參赛者在使用中对W5500有各种各样的疑问,对于这款WIZnet新推出的以太网芯片,使用中大家是不是也一样存在下面问题呢?来看一看: ...
- Android网络:HTTP之利用HttpURLConnection访问网页、获取网络图片实例 (附源码)
http://blog.csdn.net/yanzi1225627/article/details/22222735 如前文所示的TCP局域网传送东西,除了对传输层的TCP/UDP支持良好外,Andr ...
- mysql_convert_table_format 批量修改表引擎
[root@server-mysql bin]# mysql_convert_table_format --help Conversion of a MySQL tables to other sto ...
- Linux性能及调优指南(翻译)
http://blog.csdn.net/ljianhui/article/details/46718835 http://blog.chinaunix.net/uid-26000296-id-406 ...