C++
zhaoquanguo
这个作者很懒,什么都没留下…
展开
-
Conversion Operators
In C++, the programmer abstracts real world objects using classes as concrete types. Sometimes it is required to convert one concrete type to another concrete type or primitive type implicitly. Conv原创 2011-06-14 19:56:00 · 225 阅读 · 0 评论 -
C++ default constructor | Built-in types
Predict the output of following program?#include using namespace std;int main() { cout << int() << endl; return 0;}A constructor without any arguments or with default values fo原创 2011-06-15 12:41:00 · 338 阅读 · 0 评论 -
How will you print numbers from 1 to 100 without using loop?
Here is a solution that prints numbers using recursion.Other alternatives for loop statements are recursion and goto statement, but use of goto is not suggestible as a general programming practice as转载 2011-06-15 08:49:00 · 374 阅读 · 0 评论 -
Implict conversion in template class
C++ complier are very clever, it can auto try implict data types ( for plain old data ); Predict the output of the flowing codes: #include using namespace std; //get the larger of two v原创 2011-06-17 23:55:00 · 428 阅读 · 0 评论 -
Templates and multiple-file projects
From the point of view of the compiler, templates are not normal functions or classes. They are compiled ondemand, meaning that the code of a template function is not compiled until an instantiation w原创 2011-06-18 00:25:00 · 228 阅读 · 0 评论 -
When to use explicit keywork for class construct
/* * File: main.cpp * Author: qzhao * * Created on 2011年7月2日, 上午8:12 *//* * 对构造函数,进行显示声明,是为了避免隐式转换, * */#include #include using namespace std;class A {public: explicit A() : value(0) { }priv原创 2011-07-02 15:34:56 · 205 阅读 · 0 评论 -
Prefer const, enum ,inlines to #defines
/* * File: main.cpp * Author: qzhao * 这个章节是关于在进行C++日常开发的时候,尽量使用const 或者enum 取代传统的C define 宏, * 宏是提供给预编译器,来进行简单的文本替换 * 但是C++ 推荐采用const 或者 enum 变量定义. 直接让compiler 来帮忙检错。 * just as “perfer the compiler原创 2011-07-02 15:36:39 · 365 阅读 · 0 评论 -
Windows调试之内存泄漏
查找内存泄漏的重要性我想就不必多说了,言归正传! 发生内存泄漏的简单c++程序 #include using namespace std; int main() { cout const int BUFER_SIZE = 10; c原创 2011-09-08 11:58:30 · 304 阅读 · 0 评论