02 2008 档案

Data Structure--Reverse LinkList
摘要:The original Linklist is as diagram shown: the codes are following node *reverse(node *head) { node *p1,*p2,*p3; if(head==NULL || head->next=-NULL) return head; //p1-->previou... 阅读全文

posted @ 2008-02-26 11:46 飞天舞者 阅读(382) 评论(0) 推荐(0) 编辑

OPP Basic--if virtual functions are so powerful, can we declare all member functions virtual?
摘要:A: Never. cos virtual functions has costs. Each object of virtual function must have a v table to manage them.Therefore using virtual function will need system costs. for only a very small class and ... 阅读全文

posted @ 2008-02-26 11:32 飞天舞者 阅读(183) 评论(0) 推荐(0) 编辑

OOP Bisic-desctructor can be virtual,while constructer can not? why?
摘要:A: virtual function uses virtual calling. virtual calling is a kind of operation mechanism which can run on the condition of part information being provided. it allows us to call a function that... 阅读全文

posted @ 2008-02-26 11:21 飞天舞者 阅读(238) 评论(0) 推荐(0) 编辑

OOP Basic--Constructor&Destructor
摘要:本文深刻讲述了为什么有些基类的析构函数要设为virtual? 阅读全文

posted @ 2008-02-26 10:59 飞天舞者 阅读(353) 评论(0) 推荐(0) 编辑

OOP Basic--Is the class declaration right?[const]
摘要:Q: in C++ programming language, Is it right to define a class as the following shown: class A{ const int Size=0; } A: no, it's wrong! 在C++中,这样是错误的,常量成员的初始化必须在构造函数中完成。 the initiation of const must be... 阅读全文

posted @ 2008-02-26 10:31 飞天舞者 阅读(267) 评论(0) 推荐(0) 编辑

OOP Basic--what's the diff between struct & class?
摘要:Q: if struct can have the construtor/desctructor and memeber functions ? if so, what's the diff between struct& class? A: Yes! and the diff is that: in Class ,the default variables access typ... 阅读全文

posted @ 2008-02-26 10:27 飞天舞者 阅读(241) 评论(0) 推荐(0) 编辑

STL template&Container--function point & generic class
摘要:please wirte a program to realize the model described in the figure. you shoudl design your program as negeric as possible so that we can enhance the model in the future ealily without making too ... 阅读全文

posted @ 2008-02-26 09:57 飞天舞者 阅读(400) 评论(0) 推荐(0) 编辑

STL template&Container--how to change normal function into generic function.
摘要:Q: Below is usual way we find one element in an array: in this case we have to bear the knowledge of value type"int",the size of array,even the existence of an array. would you re-write it... 阅读全文

posted @ 2008-02-26 09:45 飞天舞者 阅读(265) 评论(0) 推荐(0) 编辑

Programming Basic--what is the output of the following code?
摘要:#include "iostream" #include"string.h" #include "stdio.h" class A{ }; class A2{ char d,e; }; struct B{ }; struct C{ char b,c; }; struct D{ int x,y; }; int main() { count<<sizeof(A)<<endl; cout<<... 阅读全文

posted @ 2008-02-26 09:05 飞天舞者 阅读(400) 评论(0) 推荐(0) 编辑

Programming Basic--what's the diff between const and #define?
摘要:to define a const, we can use const as well as #define in C++ .however the former has more benifits than later. 1) const has data type ,however Macro has no. so the complier can check ... 阅读全文

posted @ 2008-02-26 08:58 飞天舞者 阅读(204) 评论(0) 推荐(0) 编辑

Programming Basic--define a Macro "MIN", which has two parameters and return the less one.
摘要:#define MIN(A,B) ((A)<=(B)?(A):(B)) 阅读全文

posted @ 2008-02-26 08:53 飞天舞者 阅读(252) 评论(0) 推荐(0) 编辑

Programming Basic--what's the use of "ifndef/define/endif";
摘要:to avoid that the head file is referenced more than twice. 阅读全文

posted @ 2008-02-26 08:51 飞天舞者 阅读(200) 评论(0) 推荐(0) 编辑

Programming Basic--why we need to add ' extern "C" ' in C++ program when calling the function which is complied by C complier?
摘要:C++ support overload, but C not. and the name of function in library which is complied by C++ complier is different from that which is complied by C complier. for example: if a function prototyp... 阅读全文

posted @ 2008-02-26 08:49 飞天舞者 阅读(180) 评论(0) 推荐(0) 编辑

Exchange a,b without using other variables
摘要:there are two ways: 1: a=a+b; b=a-b; a=a-b; //in this case, if a or b is a very big number, a+b maybe will overflow. 2: a=a^b; b=a^b; a=a^b; 阅读全文

posted @ 2008-02-26 08:42 飞天舞者 阅读(199) 评论(0) 推荐(0) 编辑

C++的四种cast操作符的区别
摘要:Q:什么是C风格转换?什么是static_cast, dynamic_cast 以及 reinterpret_cast?区别是什么?为什么要注意? A:转换的含义是通过改变一个变量的类型为别的类型从而改变该变量的表示方式。为了类型转换一个简单对象为另一个对象你会使用传统的类型转换操作符。比如,为了转换一个类型为doubole的浮点数的指针到整型: 代码: int i; double d; ... 阅读全文

posted @ 2008-02-20 10:51 飞天舞者 阅读(565) 评论(0) 推荐(0) 编辑

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
For more information about me, feel free email to me winston.he@hotmail.com
点击右上角即可分享
微信分享提示