设计模式是为程序代码优化而诞生的,目的是设计出易维护、容易拓展、易复用、灵活性好的程序。设计模式体现是面向对象的三大思想:封装、继承和多态。设计模式(Design pattern)是一套被反复使用、多数人知晓的、经过分类编目的、代码设计经验的总结。使用设计模式是为了可重用代码、让代码更容易被他人理解、保证代码可靠性。 毫无疑问,设计模式于己于他人于系统都是多赢的;设计模式使代码编制真正工程化;设计...
分类:
其他好文 时间:
2014-06-07 01:29:07
阅读次数:
257
Problem Description:
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete at most two transa...
分类:
其他好文 时间:
2014-06-05 09:33:52
阅读次数:
342
screen.availWidth 属性返回访问者屏幕的宽度,以像素计,减去界面特性,比如窗口任务栏。
screen.availHeight 属性返回访问者屏幕的高度,以像素计,减去界面特性,比如窗口任务栏。
-------------------------------------------完整的例子-------------------------------------------
...
分类:
Web程序 时间:
2014-06-05 07:47:36
阅读次数:
364
1 设计一个基类
2 继承这个基类,并包含这个基类的一个对象
3 创建继承类的时候,初始化这个基类,因为是基类指针,所以可以是所有基类的衍生类对象,那么就可以叠加任意多个衍生类对象了。
关键是在衍生类中包含一个基类对象,然后有了继承和包含两重关系,可以使得一个类一个类对象叠加,达到装饰目的。
等于是创建了一个对象指针链表,一个一个对象发挥其相应的作用。
下面程序装饰一个桌...
分类:
其他好文 时间:
2014-06-05 06:15:17
阅读次数:
278
Screen.h#ifndef SCREEN_H#define SCREEN_H#include
class Screen {public: typedef std::string::size_type pos; // Action is a type
that can point to...
分类:
其他好文 时间:
2014-06-04 20:59:09
阅读次数:
350
获取当前工作区宽度和高度(工作区不包含状态栏) int ScreenWidth =
Screen.PrimaryScreen.WorkingArea.Width; int ScreenHeight =
Screen.PrimaryScreen.WorkingArea.Height;
/** * 获得当前屏幕亮度的模式 *
SCREEN_BRIGHTNESS_MODE_AUTOMATIC=1 为自动调节屏幕亮度 * SCREEN_BRIGHTNESS_MODE_MANUAL=0
为手动调节屏幕亮度 */ private int getScreenMode()...
分类:
移动开发 时间:
2014-05-31 16:57:37
阅读次数:
275
For screening materials for different sizes,
vibrating screen is playing its role. After separating, the aggragates that can
meet your requirements wi...
分类:
其他好文 时间:
2014-05-31 15:20:11
阅读次数:
205
Say you have an array for which theithelement
is the price of a given stock on dayi.Design an algorithm to find the maximum
profit. You may complete a...
分类:
其他好文 时间:
2014-05-30 16:19:05
阅读次数:
320
Say you have an array for which theithelement
is the price of a given stock on dayi.Design an algorithm to find the maximum
profit. You may complete a...
分类:
其他好文 时间:
2014-05-30 15:00:54
阅读次数:
335