简单工厂模式(Factory Method):定义一个用于创建对象的接口,让子类决定将哪一个类实例化。Factory Method使一个类的实例化延迟到其子类。
package gof23;
public class SimpleFactoryTest {
public static void main(String[] args) {
Operation oper = null;
...
分类:
其他好文 时间:
2014-07-24 17:36:46
阅读次数:
223
//判断date1是否大于date2+dayfunction compareDate(date1, date2, day) { var startdate = new Date((date1).replace(/-/g, "/")); var enddate = date2 == null ? ne...
分类:
Web程序 时间:
2014-07-24 17:16:05
阅读次数:
226
//捕获fopen调用中的错误#include#include#include#defineMYFILE"missing.txt"intmain() { FILE*fin; fin=fopen(MYFILE,"r"); if(fin==(FILE*)NULL) { printf("%s:%s\n",...
分类:
系统相关 时间:
2014-07-24 16:56:45
阅读次数:
298
今天解析DEDECMS时发现deder的MYSQL时间字段,都是用 `senddata` int(10) unsigned NOT NULL DEFAULT ‘0‘; 随后又在网上找到这篇文章,看来如果时间字段有参与运算,用int更好,一来检索时不用在字段上转换运算,...
分类:
数据库 时间:
2014-07-24 12:32:48
阅读次数:
385
实现: 1 #ifndef BINARY_SEARCH_TREE_H 2 #define BINARY_SEARCH_TREE_H 3 4 #include "dsexceptions.h" 5 #include // For NULL 6 using namespace st...
分类:
其他好文 时间:
2014-07-24 10:03:33
阅读次数:
398
实现: 1 #ifndef AVL_TREE_H 2 #define AVL_TREE_H 3 4 #include "dsexceptions.h" 5 #include // For NULL 6 using namespace std; 7 8 // AvlTree...
分类:
其他好文 时间:
2014-07-24 10:01:43
阅读次数:
317
题目:A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep c....
分类:
编程语言 时间:
2014-07-24 10:00:33
阅读次数:
310
// 从第一个字符串中删除第二个字符串中出现过的所有字符#include char* remove_second_from_first( char *first, char *second ){ if( first == NULL || second == NULL ) { ...
分类:
其他好文 时间:
2014-07-24 09:58:23
阅读次数:
163
题目:Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2-....
分类:
编程语言 时间:
2014-07-24 09:53:16
阅读次数:
219
题目:Reverse a linked list from position m to n. Do it in-place and in one-pass.For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->....
分类:
编程语言 时间:
2014-07-24 09:49:43
阅读次数:
204