- 博客(72)
- 资源 (7)
- 收藏
- 关注
原创 拷贝构造函数 不同编译器
[flydream@flydream InterView]$ cat Point.cpp #include using namespace std; class Point { public: Point(int xx = 0, int yy = 0) { X = xx; Y = yy; } Point(const Point &p);
2012-06-10 10:22:29
273
转载 第五讲:类的成员、对象成员的引用
本文出自http://210.44.193.6/C++/text/05.htm 本讲基本要求 掌握:类成员函数的性质、定义及存贮方式。对象成员三种引用方式,。 理解:类函数、作用域运算符、inline成员函数的概念。 重点、难点:类成员函数的性质、定义、存贮方式及引用;对象成员三种引用方式。 一、类的成员函数(成员数据、成员函数与全局函数)(成员函数的性质、定义)
2012-06-10 08:18:43
373
转载 中继器,集线器,网桥,交换机,路由器有什么区别?
1,中继器是物理层上的网络互连设备,它的作用是重新生成信号(即对原信号进行放大和整形)。 中继器(Repeater)又称重发器,是一种最为简单但也是用得最多的互连设备。中继器仅适用于以太网,可将两段或两段以上以太网互连起来。中继器只对电缆上传输的数据信号再生放大,再重发到其它电缆段上。对链路层以上的协议来说,用中继器互连起来的若干段电缆与单根电缆并无区别(除了中断器本身会引起一定的时间延迟外
2012-06-07 09:31:52
570
转载 C++中的空类,默认产生哪些类成员函数?
class Empty { public: Empty(); // 缺省构造函数 Empty( const Empty& ); // 拷贝构造函数 ~Empty(); // 析构函数 Empty& operator=( const Empty& ); // 赋值运算符 Empty* operator&(); // 取址运算符 const Empty* operator&()
2012-06-06 12:00:55
1179
原创 数组初始化
[flydream@flydream C++]$ cat X.cpp #include using namespace std; int main(int argc, char *argv[]) { unsigned int const size1 = 2; char str1[size1]; unsigned int temp; cin >> temp; const
2012-06-06 11:52:58
268
转载 #error 的作用
#error 预处理指令的作用是,编译程序时,只要遇到#error 就会生成一个编译错误提 示消息,并停止编译。其语法格式为: #error error-message 注意,宏串error-message 不用双引号包围。遇到#error 指令时,错误信息被显示,可能同时 还显示编译程序作者预先定义的其他内容。
2012-06-06 10:54:20
346
转载 c++ mianshi
1. 以下三条输出语句分别输出什么?[C易] char str1[] = "abc"; char str2[] = "abc"; const char str3[] = "abc"; const char str4[] = "abc"; const char* str5 = "abc"; const char* str6 = "abc"; cout
2012-06-06 10:03:09
272
原创 以下代码有什么问题?[C++易]
struct Test { Test( int ) {} Test() {} void fun() {} }; void main( void ) { Test a(1);
2012-06-06 09:27:18
293
转载 绝对不要重新定义继承而来的缺省参数
看下面这个例子: class CBase { public: virtual void Test(int iTest = 0) const = 0; }; class CDerived : public CBase { public: void Test(int iTest = 1) const { cout }; 下面是调用例子: CBase *p
2012-06-05 21:15:40
233
原创 虚函数 与 纯虚函数
#include using namespace std; class Base { public: /* virtual */ ~Base() { cout Base() { cout }; class Third : public Base { public: ~Third() { cout
2012-06-05 08:11:41
242
原创 纯虚函数
纯虚函数只能在派生类中实现,虚函数可以在基类中实现。 用父类的指针在运行时刻来调用子类。父类指针通过虚函数来决定运行时刻到 底是谁而指向谁的函数。 有纯虚函数的类是抽象类,不能生成对象,只能派生。他派生的类的纯虚函数 没有被改写,那么,它的派生类还是个抽象类。定义纯虚函数就是为了让基类 不可实例化。 [flydream@flydream C++]$ cat PureVirtual.
2012-06-04 19:35:31
284
转载 C++
[flydream@flydream A]$ cat AA.cpp #include using namespace std; class Base { public: virtual void f(float x) { cout } void g(float x)
2012-06-04 11:51:06
183
原创 重载 覆盖 隐藏
成员函数被重载的特征: (1)相同的范围(在同一个类中); (2)函数名字相同; (3)参数不同; (4)virtual 关键字可有可无。 (5) 不能够以返回值重载。 覆盖是指派生类函数覆盖基类函数,特征是: (1)不同的范围(分别位于派生类与基类); (2)函数名字相同; (3)参数相同; (4)基类函数必须有 virtual 关键字。 “隐藏”是指派生类的函数屏
2012-06-04 10:33:18
234
原创 C++
情况1: [flydream@flydream A]$ cat A.cpp #include using namespace std; class Base { public: void f2() { cout } void f1() { cout
2012-06-03 21:37:50
210
翻译 无数据成员类的大小
// Available at http://www.BruceEckel.com // (c) Bruce Eckel 2000 // Copyright notice in Copyright.txt // Sizes of structs #include "CLib.h" #include "CppLib.h" #include using namespace std; struct
2012-04-29 08:32:37
305
翻译 函数指针
[flydream@flydream ThinkingInC++]$ cat PointerFunction.cpp #include using namespace std; void F(int a) { cout } int main(int argc, char **argv) { void (* PF)(int); /* 定义一个函数指针
2012-04-28 21:11:23
221
转载 C语言可变参数
1,首先,怎么得到参数的值。对于一般的函数,我们可以通过参数对应在参数列表里的标识符来得到。但是参数可变函数那些可变的参数是没有参数标识符的,它只有“…”,所以通过标识符来得到是不可能的,我们只有另辟途径。 我们知道函数调用时都会分配栈空间,而函数调用机制中的栈结构如下图所示: | ...... |
2012-04-28 17:58:14
915
转载 unsigned char i = -20
[flydream@flydream ThinkingInC++]$ cat unsigned.c #include int main(int argc,char *argv[]) { unsigned char i; i = -20; printf("i = %d\n", i); return 0; } [flydream@flydream
2012-04-28 17:56:08
1518
转载 关于unsigned char
[flydream@flydream ThinkingInC++]$ cat unsigned.c #include int main(int argc,char *argv[]) { unsigned char i; i = -20; printf("i = %d\n", i); return 0; } [flydream@flydream
2012-04-28 17:41:52
256
转载 预处理命令# 和 ##
# 和 ## 操作符是和#define宏使用的. 使用# 使在#后的首个参数返回为一个带引号的字符串. 例如, 命令 #define to_string( s ) # s 将会使编译器把以下命令 cout << to_string( Hello World! ) << endl; 理解为 cout << "Hello World!" << endl;
2012-04-28 17:21:52
294
翻译 指针和数组
[flydream@flydream ThinkingInC++]$ cat -n array.cpp 1 #include 2 3 using namespace std; 4 5 int main(int argc, char **argv) 6 { 7
2012-04-28 16:34:45
180
翻译 union详解
[flydream@flydream ThinkingInC++]$ cat union.cpp -n 1 #include 2 3 using namespace std; 4 5 union Packed 6 { 7 char i; 8
2012-04-28 15:52:52
233
翻译 enum 详解
[flydream@flydream ThinkingInC++]$ cat enum.cpp #include using namespace std; int main(int argc, char **argv) { enum ShapType { circle, rectangle, square
2012-04-28 15:43:59
185
原创 变量的作用域 auto, register, static, extern
局部变量 默认 auto 不可能得到register变量的地址, 不可能有全局的或则static的register变量, 然而可以在函数的参数列表中出现register变量 static 变量用在函数中表示只有在函数中作用, 是放在静态存储区的, 每次调用函数才可能作用。 另一层意思是具有文件作用域。 在类中也可以用static 下面的两个文件会出现编译时错误。 file
2012-04-28 11:12:53
387
原创 void 指针
[flydream@flydream ThinkingInC++]$ cat CastFromVoidPointer.cpp #include using namespace std; int main(int argc, char **argv) { int i = 99; void *vp = &i; // *vp = 100; C
2012-04-28 11:05:43
157
原创 传递指针和传递引用
[flydream@flydream ThinkingInC++]$ cat PassReference.cpp #include using namespace std; void passPointer(int *P) { cout cout *P = 100; } void passReference(int &R)
2012-04-28 10:57:24
165
原创 bool 和 enum 大小
[flydream@flydream ThinkingInC++]$ cat boolenumSize.cpp #include using namespace std; int main(int argc, char **argv) { typedef enum { Monday, Tuesday, Wendesday, Thursday, Friday, Satur
2012-04-28 10:31:24
298
原创 ThinkInC++ 笔记 => Vector 例子
[flydream@flydream ThinkingInC++]$ cat FillString.cpp #include #include #include using namespace std; int main(int argc, char **argv) { string s, line; ifstream in("./FillStri
2012-04-28 10:04:57
192
原创 ThinkInC++ 笔记 => 读取输入数据
[flydream@flydream ThinkingInC++]$ cat InputData.cpp #include using namespace std; int main(int argc, char **argv) { int InputData; cout cin >> InputData; c
2012-04-28 08:56:52
182
翻译 ThinkInC++ 笔记 => 字符数组的拼接
[flydream@flydream C02]$ cat Concat.cpp //: C02:Concat.cpp // From Thinking in C++, 2nd Edition // Available at http://www.BruceEckel.com // (c) Bruce Eckel 2000 // Copyright notice in Copyright
2012-04-28 08:47:11
234
原创 编译安装GCC
1. 下载GCC 源码包 : gcc-4.6.3.tar.bz2 2. 下载GCC 依赖包: gmp-5.0.4.tar.bz2, mpfr-3.1.0.tar.bz2 ,mpc-0.9.tar.gz 3. 解压gcc-4.6.3.tar.bz2 指令=》 [flydream@flydream opt]$ tar -xvf gcc-4.6.3.tar.bz2 4. 进入[flydrea
2012-04-24 10:56:00
1412
转载 sys_socket 原型
转载地址:http://blog.csdn.net/csalp/article/details/6455387 系统调用(追踪sys_socket) 在include/linux/syscalls.h中定义了sys_socket函数的函数原型(prototype) asmlinkage long sys_socket(int, int, int); 系统
2012-04-22 22:21:12
951
原创 glibc 安装出错解决方案
glibc 版本glibc-2.14.1 修改如下两个文件 [root@flydream glibc_install]# vim ../glibc-2.14.1/sysdeps/unix/sysv/linux/i386/sysdep.h [root@flydream glibc_install]# vim ../glibc-2.14.1/nptl/sysdeps/pthread/pt-i
2012-04-22 14:48:00
682
转载 详细解说/etc/group /etc/passwd /etc/shadow文件
在Linux中,用户(User)和用户组(Group)的配置文件,是作为系统管理员的你最应该了解和掌握的系统基础文件之一。从另一方面来说,了解这些文件也是系统安全管理的重要组成部份,作为一个合格的系统管理员一定要对用户和用户组配置文件了解透彻才行; 一、用户(User)相关: 谈到用户,就不得不谈用户管理、用户配置文件、以及用户查询和管理的控制工具;用户管理主要通过修改用户配置文件完
2012-04-21 14:49:45
2078
转载 login shell and nonlogin shell
转载地址:http://www.isayme.org/linux-diff-between-login-and-non-login-shell.html 今天遇到的问题,通过su命令切换用户并没有进入该用户的shell环境。这是为什么? 先介绍login shell和non-login shell概念: login shell:去的bash时需要完整的登录流程。就是说通过输入账号和密
2012-04-20 16:04:43
520
转载 set env export区别
set,env和export这三个命令都可以用来显示shell变量,区别 [root@localhost root]# aaa=bbb [root@localhost root]# echo $aaa bbb [root@localhost root]# set |grep aaa aaa=bbb [root@localhost root]# env |grep aaa [root@
2012-04-20 15:32:23
175
转载 软链接与硬链接
链接——是一种在共享文件和访问它的用户的若干目录项之间建立联系的一种方法。在Linux中分为软链接(soft link)和硬链接(hard link),其中软链接又称为符号链接(symbolic link)。 1、索引节点:在linux系统中对文件的管理本质上是通过其索引节点进行管理的。从系统的角度来看,文件的索引节点(inode)是文件的唯一标识,它包含了文件系统处理文件所需要的全部信息。详细
2012-04-20 13:25:22
359
转载 软链接与硬链接
链接——是一种在共享文件和访问它的用户的若干目录项之间建立联系的一种方法。在Linux中分为软链接(soft link)和硬链接(hard link),其中软链接又称为符号链接(symbolic link)。 1、索引节点:在linux系统中对文件的管理本质上是通过其索引节点进行管理的。从系统的角度来看,文件的索引节点(inode)是文件的唯一标识,它包含了文件系统处理文件所需要的全部信息。详细
2012-04-20 12:58:58
130
原创 man page
DESCRIPTION man is the system's manual pager. Each page argument given to man is normally the name of a program, utility or function. The manual page associated with each of these
2012-04-19 15:08:47
154
CSS 标准教程 很好的入门教程 也可以作为参考书 很不错的哈
2010-02-03
RSA加密软件 (VC++,MFC程序实现)
2009-05-27
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人