摘要:const vbformcontrolmenu=0 ´user has chosen close command from control menu box on formconst vbformcode=1 ´unload method invoked from codeconst vbappwindows=2 ´current windows session......
摘要:[文章导读] 学习vc++时经常会遇到链接错误lnk2001,该错误非常讨厌,因为对于编程者来说,最好改的错误莫过于编译错误 [正文] 学习vc++时经常会遇到链接错误lnk2001,该错误非常讨厌,因为对于编程者来说,最好改的错误莫过于编译错误,而一般说来发生连接错误时,编译都已通过。产生连接错误的原因非常多,尤其lnk2001错误,常常使人不明其所以然。如果不深入地学习和理解vc++,要想改正......
C++ Primer学习笔记第六章tquery.cpp程序的剖析/*
我用的编译器是gnu c++ 与 vc2003,为了此程序能够执行需做以下的修改: 【程序编程相关:
Jive 源代码探索】
tquery.c 【推荐阅读:
数据库的跨平台设计 】
2 <iostream.h> à <iostream>, <fstream.h> à <fstream> , <stddef.h> à <cstddef> 【扩展信息:
关于JAVA操作系统的对话】
1 tquery.c à tquery.cpp
3 增加 #include <iterator>
4 删除 allocator 与它前面的“,”号,注意在要在>>之间留一个空格,因为编译器不是神仙,它会把>>当成操作符
5 删除250行的diff_type,对于现在的编译器,它已经过时了
6 对于执行gnu c++ 执行:g++ -o tquery.ext tquery.cpp 〔enter〕
7 对于vc2003 执行:cl tquery.cpp 〔enter〕
*/
#include <algorithm> //提供泛型算法的接口,比如copy
#include <string>
#include <vector>
#include <utility> //pair的接口
#include <map>
#include <set>
#include <iostream>
#include <fstream>
#include <cstddef> //定义了null,size_t等类型
#include <ctype.h> //为了大小写字母的处理
#include <iterator> //因为运用了ostream_iterator模板对象所以这是必须的,而原程序没有包含
typedef pair<short,short> location; //这样做完全是为了方便理解,没有太大的意义
typedef vector<location> loc;
typedef vector<string> text;
typedef pair<text*,loc*> text_loc; //完整的类型是pair< vector<string>*, vector< pair<short,short> >* >
//如果是我写的话,肯定会把location,loc,text,text_loc排在一列,李破门先生为何要这么做?我想大概是个人的喜好问
//题,这样做有它的好处,就是不会把定义相互混淆
class textquery {
public:
textquery() { memset( this, 0, sizeof( textquery )); } //我们知道memset是一个c语言的函数,这句把this指向的那块内存大小为sizeof(textquery)个单元初值设置为0,我对这个构造函数的理解是:因为此类的成员函数操纵的是一些string,所以把内存做这样的解释是为了提高string处理的效率,因为memset虽然返回的是void*指针,但是却被编译器解释成char*指针
static void filter_elements( string felems ) { filt_elems = felems; }
void query_text();
void display_map_text();
void display_text_locations();
void doit() {
retrieve_text();
separate_words();
filter_text();
suffix_text();
strip_caps();
build_word_map();
}
private:
void retrieve_text();
void separate_words();
void filter_text();
void strip_caps();
void suffix_text();
void suffix_s( string& );
void build_word_map();
private:
vector<string,allocator> *lines_of_text;
text_loc *text_locations;
map<string,loc*,less<string>,allocator> *word_map;...
下一页 摘要:第一,谈谈final, finally, finalize的区别。
final—修饰符(关键字)如果一个类被声明为final,意味着它不能再派生出新的子类,不能作为父类被继承。因此一个类不能既被声明为 abstract的,又被声明为final的。将变量或方法声明为final,可以保证它们在使用中不被改变。被声明为final的变量必须在声明时给定初值,而在以后的引用中只能读取,不可修......