11 2012 档案
摘要:为了便于输出_x和_y的值,直接将它们声明为public。如果在子类中主动调用父类的构造函数将会发现输出的_x的值为0。class base_class{public: base_class(int val = 0) : _x(val) { std::cout<<"base_class() con"<<std::endl; } base_class(const base_class &rhs) : _x(rhs._x) { std::cout<<"base_class() copy"<<std::e
阅读全文
摘要:SMTP还是比较简单的,首先使用tcp协议连接自己邮箱的smtp服务器的25号端口,接着就是一次send给服务器发送命令,一次recv读取服务器的返回状态。 大家可以使用windows自带的telnet工具来测试学习smtp协议。 下面是C++实现的代码,参考了不少资料,其中的check_server_response()函数没写完,未考虑命令执行失败的情况。代码中使用了上一篇文章中的Base64...
阅读全文
摘要:借助Base64可以将任意的二进制数据格式转换为可见字符的形式。每3个字节被转换为4个字符,转换之后的字符长度一定为4的倍数。 因此,如果只有两个字节,只能转换为3个字符,因此最后需要补一个字符'=';同理1个字节最后需要补两个'='。 class Base64Encode{public: Base64Encode() { memcpy(_base_char, "ABCDEFGHIJKLMNOP...
阅读全文
摘要:Declaring a member function with the const keyword specifies that the function is a "read-only" function that does not modify the object for which it is called.To declare a constant member function, place the const keyword after the closing parenthesis of the argument list. The const keywo
阅读全文
摘要:1.重载一元操作符To declare a unary operator function as a nonstatic member, you must declare it in the form:ret-typeoperatorop()where ret-type is the return type and op is one of the operators listed in the preceding table.To declare a unary operator function as a global function, you must declare it in th
阅读全文
摘要:Comparing Two High-Performance I/O Design Patterns by Alexander Libman with Vladimir Gilbourd November 25, 2005 Summary This article investigates and compares different design patterns of high per...
阅读全文
浙公网安备 33010602011771号