Time of Update: 2018-12-05
chain.h#pragma once#include <QDebug>class CHandle{public:CHandle():m_handle(0){}CHandle(CHandle *hadle):m_handle(hadle){}virtual ~CHandle(){if (m_handle){delete m_handle;}}virtual void handleRequest() = 0;virtual void setHandle(CHandle* handle)
Time of Update: 2018-12-05
Bridge模式使得抽象和實現能夠相對獨立。bridge.h#pragma once#include <QDebug>class CImplementor{public:virtual void operateImp() = 0;};class CRectImplementor : public CImplementor{public: CRectImplementor(){}void operateImp(){ qDebug() << "this is a Rect";
Time of Update: 2018-12-05
1.定義Collection 類在C#語言中定義一個Collection 類最簡單的方法就是把在System.Collections 庫中已找到的抽象類別CollectionBase 類作為基礎類。此類提供了一套可以實現構造自身群集的抽象方法集合。CollectionBase 類還提供了一種基礎的資料結構——InnerList(一個ArrayList)。此結構可以用作自身類的基礎。本章節會看到如何使用CollectionBase 來構造Collection類。2. 實現Collection
Time of Update: 2018-12-05
《Singleton.h》#include<iostream>#include<string>using namespace std;class A{public: static A* GetInstance(); void ShowAddress();private:A();virtual ~A();static A* m_p;};《Singleton.cpp》#include "Singleton.h"A*A::m_p = NULL;A::A(){
Time of Update: 2018-12-05
《TemplateMethod1.h》#include <iostream>#include <string> using namespace std;class A{public: A(){}; virtual ~A(){}; void Method();protected: virtual void b() = 0; virtual void c() = 0;};class B: public A{public: B(){};
Time of Update: 2018-12-05
mediator.h#pragma once#include <QDebug>class CMediator;class CCountry{public:virtual void setMediator(CMediator *mediator) = 0;virtual void sendMessage(const QString& message) = 0;virtual void getMessage(const QString& message) =
Time of Update: 2018-12-05
這個模式利用了回呼函數技術。command.h#pragma once#include <QDebug>class CCommand{public:virtual void execute() = 0;};class CReceiver{public:void action(){qDebug() << "action fact!";}};class ConCreateCommand : public
Time of Update: 2018-12-05
c語言中 引用標頭檔時“”與<>的區別C語言編譯器會用一些目錄存放公用標頭檔;如果用<>則只在公用目錄下找標頭檔;如果用""先在目前的目錄下找,如果找不到則在這些目錄下找。即""的尋找範圍大(包括<>的尋找範圍),當標頭檔在目前的目錄下時""的尋找速度快。一般來說,自己定義的標頭檔應該用"",因為這些檔案放在工程目錄(也就是編譯器的目前的目錄)下,而不是放在公用標頭檔目錄下,如果用<>則找不到標頭檔。而系統提供的標頭檔,比如庫函數的標頭檔,可以用&
Time of Update: 2018-12-05
來源:c語言實現網域名稱解析對原文進行了一點小修改,原文可能是在C++環境編譯的,比如“.cpp”尾碼的檔案編譯的,“.cpp”檔案預設以C++方式編譯,所以原文如果複製儲存為“.c”尾碼的,編譯是通不過的,很多錯誤。以下是修改過後的代碼,DNS請修改為自己所在地區的DNS地址,經測試,直接使用路由IP也可。網域名稱輸入例如:“www.baidu.net”,不含引號。測試“www.csdn.net”得到的IP在瀏覽器開啟不是csdn,不知道為什麼,其他網域名稱未測試。c語言實現網域名稱解析:#i
Time of Update: 2018-12-05
server 端:
Time of Update: 2018-12-05
C++ 作為Client端[cpp] view
Time of Update: 2018-12-05
using System; namespace bbbb{ class bbb { private const int account = 5; static void Main(string[] args) { int temp; int[] num = new int[5]; for (int i = 0; i < account; i++)
Time of Update: 2018-12-05
using System;using System.Collections.Generic;using System.Text;using System.Windows.Forms;using System.Data.SqlClient; namespace NewApp{ class AutoComplete { List<TextBox> _CompleteObjectList = new List<TextBox>();
Time of Update: 2018-12-05
C++儲存修飾符解釋(純理論部分)在C++中,儲存空間主要是指變數或者函數或者類(下文中為了方便都稱為標識符)的可見度和使用範圍。為此C++提供下面幾個儲存空間修飾(storageclassspecifiers),這些修飾符告訴編譯器標識符的生存周期和可見度(可以理解為可引用性),以及這些標識符是應該如何被儲存。生存空間修飾符:autoregisterstaticextern本文分成幾個部分,每一個部分相對獨立。////////////////////////////////////////
Time of Update: 2018-12-05
JAVA與C++::關於JNI中文字串操作問題總結/** * *@Author ZosaTapo * *@E-Mail dertyang@263.net * *@QQ 1670967 * */[問題簡單背景]使用JAVA編程有時候需要使用JNI來實現效率方面或者是其他方面的問題。在JNI使用中不得不面臨的問題就是中文問題(如果你是老外,並且不關心中國建設,那就不用看了;或者你已經知道如何解決 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Time of Update: 2018-12-05
物件導向的語言諸如JAVA提供了Interface來實現介面,但C++卻沒有這樣一個東西,儘管C++ 通過純虛基類實現介面,譬如COM的C++實現就是通過純虛基類實現的(當然MFC的COM實現用了嵌套類),但我們更願意看到一個諸如 Interface的東西。下面就介紹一種解決辦法。首先我們需要一些宏://// Interfaces.h//#define Interface class#define DeclareInterface(name) Interface name { /
Time of Update: 2018-12-05
The keyword this identifies a special type of pointer. Suppose that you create an object named x of class A, and class A has a nonstatic member function f(). If you call the function x.f(), the keyword this in the body of f() stores the address of
Time of Update: 2018-12-05
上一次我們主要說明數組,指標,指標數組,數組指標這幾個很基本的概念,不過有一點上一次我沒有提及,那就是我們使用typedef定義指向數組指標的數組,這個叫法是不是很拗口呀,不過我們看具體的程式就清楚了。file://----------數組--------------int a[2]={10,20};int b[2]={30,40};file://簡單的指向兩個元素數組的指標int (*p2arr)[2]=&a;file://---------注意這裡的變化--------file://
Time of Update: 2018-12-05
http://www.cnblogs.com/shiyangxt/archive/2008/09/14/1290827.html C語言實現源碼,供參考!餘弦函數:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#include<stdio.h>#include<math.h>void main(){double y;int
Time of Update: 2018-12-05