用来创建独一无二的,是能有一个实例的对象的入场券。告诉你一个好消息,单例模式的类图可以说是所有模式的类图中最简单的,事实上,它的类图上只有一个类!但是,可不要兴奋过头,尽管从类设计的视角来说很简单,但是实现上还是会遇到相当多的波折。所以,系好安全带,出发了! <! more 介绍 定义 单例模式(S ...
分类:
编程语言 时间:
2019-05-13 16:35:34
阅读次数:
177
vue的实例属性$options是用来获取定义在data外的数据和方法的。 ...
分类:
其他好文 时间:
2019-05-13 16:19:26
阅读次数:
172
简单的说: 方法就是完成特定功能的代码块– 在很多语言里面都有函数的定义– 函数在Java中被称为方法 ? 格式:– 修饰符 返回值类型 方法名(参数类型 参数名1, 参数类型参数名2…) {函数体;return 返回值;} ...
分类:
编程语言 时间:
2019-05-13 16:04:18
阅读次数:
107
1 #include 2 3 int main() { 4 int a = 2, b = 3, c = b % a;// b % a == 1 5 if (a 20 21 int main() { 22 int a = 2, b = 3, c = b % a;// b % a == 1 23 if ... ...
分类:
其他好文 时间:
2019-05-13 16:03:46
阅读次数:
136
Given an Iterator class interface with methods: next() and hasNext(), design and implement a PeekingIterator that support the peek() operation -- it e ...
分类:
其他好文 时间:
2019-05-13 15:56:19
阅读次数:
91
1、自定义一个日期转函数,如: function formatDate(val) { var year = parseInt(val.year) + 1900; var month = (parseInt(val.month) + 1); month = month > 9 ? month : (' ...
分类:
Web程序 时间:
2019-05-13 13:53:45
阅读次数:
312
/** * 单例模式:懒汉式 */class Singleton{ private static volatile Singleton singleton = null; private Singleton(){ } public static Singleton getInstance(){ if ...
分类:
其他好文 时间:
2019-05-13 12:40:19
阅读次数:
87
看上面的标题的意思是,函数还能套函数? 此时,在最外层调用change_name2()出错 作用域在定义函数时就已经固定住了,不会随着调用位置的改变而改变 ...
分类:
其他好文 时间:
2019-05-13 12:22:41
阅读次数:
124
/** * 冒泡排序 * @param arr */public static void bubbleSort(int [] arr){ for(int i= 0;i < arr.length -1;i++){ for (int j=0;j < arr.length-1-i;j++){ if(arr ...
分类:
编程语言 时间:
2019-05-13 12:16:14
阅读次数:
81
#include<stdio.h>#include<stdlib.h>intmystrcmp(char*str1,char*str2){for(;*str1!=‘\0‘;str1++,str2++){if(*str1!=*str2){if(*str1>*str2){return1;}elseif(*str1<*str2){return-1;}}}if(*str1
分类:
编程语言 时间:
2019-05-13 11:01:24
阅读次数:
148