Time of Update: 2015-05-23
標籤:簡單原廠模式 c++ 表驅動法 設計模式 上回《大話設計模式C++版——簡單原廠模式》中指出了簡單原廠模式的缺陷,即違背了開發—封閉原則,其主要原因是由於switch的判斷結構的使用,使修改或添加新的對象時需要改動簡單工廠類的代碼,如何改造switch結構,表驅動法就可以粉墨登場了。表驅動法的介紹見《資料驅動編程之表驅動法》。1、面向介面編
Time of Update: 2015-05-23
標籤:template 鏈表 雙向迴圈鏈表 #include <iostream>using namespace std;template<typename Type>struct Node{ Node<Type> *next; Node<Type> *prve; Type data; Node(Type d = Type(
Time of Update: 2015-05-23
標籤:// CTest.cpp : 定義控制台應用程式的進入點。//#include "stdafx.h"#include <iostream>#include <math.h>using namespace std;class Cpoint{private: double x,y;public: Cpoint(double x1,double y1){ x=x1;y=y1; } void print(){
Time of Update: 2015-05-23
標籤:主要內容:一、C++文法特點簡介二、第一個HelloWorld情境三、建立一個情境 一、C++文法特點簡介1. 函數的聲明和定義分開例如AppDelegate.h中聲明的函數都在AppDelegate.cpp中定義TIPS:按F12直接跳到Definition2. #include先行編譯在需要調用其他類中的一些方法時,必須#include其標頭檔比如這裡如果不#include
Time of Update: 2015-05-23
標籤:// CTest.cpp : 定義控制台應用程式的進入點。//#include "stdafx.h"#include <iostream>#include <string.h>#include <stdio.h>using namespace std;class str{private: char s[80];public: str(char c[]){ strcpy(s,c); } str(){ }
Time of Update: 2015-05-23
標籤:設計模式 原廠模式 簡單原廠模式 c++ 簡單原廠模式應該是所有設計模式中最簡單,也最基礎的一種模式,以下是一個簡單的採用原廠模式寫一個加減法的計算機。1、抽象介面類——依賴倒轉原則(高層和底層都要依賴於抽象,針對介面編程)class IOperation{public:IOperation() : m_nNuml(0), m_nNumr(0)
Time of Update: 2015-05-23
標籤://C++ 虛函數、靜態聯編和動態聯編、抽象類別#include<iostream>#include<string>using namespace std;class People{private: string name; int age;public: People(string name_, int
Time of Update: 2015-05-23
標籤:在拼接SQL的時候經常會遇到此類問題,尤其是in查詢的時候,內容是一段 單引號的 字元的時候
Time of Update: 2015-05-23
標籤: 1 #include "stdafx.h" 2 #include <iostream> 3 using namespace std; 4 5 int _tmain(int argc, _TCHAR* argv[]) 6 { 7 char **p; 8 char * b[] = {"Fortran","C/C++","Pascal","Basic"}; 9 p = b;10 cout<< *p<<endl;
Time of Update: 2015-05-23
標籤:// CTest.cpp : 定義控制台應用程式的進入點。//#include "stdafx.h"#include <iostream>using namespace std;class Circle{ private: double x,y,r; public: void display(){
Time of Update: 2015-05-23
標籤://結構體的測試// CTest.cpp : 定義控制台應用程式的進入點。//#include "stdafx.h"#include <iostream>using namespace std;struct person{char name[15];char sex;int age;}m[3]={{"FangMin",‘F‘,24},{"LiLin",‘M‘,23},{"WuBin",‘M‘,23}};int _tmain(int argc, _TCHAR*
Time of Update: 2015-05-23
標籤:使用結構體錯誤:#include <stdio.h>struct STU{ char *name; int score;}stu,*pstu;int main (){ strcpy(stu.name,"bit-tech"); strcpy(pstu->name,"bit-tech"); return 0;} 錯誤一:strcpy(stu.name,”bit-tech”);
Time of Update: 2015-05-23
標籤:設定:HttpCookie cookie = new HttpCookie("cookieName"); cookie.Value = "name1"HttpContext.Current.Response.Cookies.Add(cookie); 讀取:HttpContext.Current.Request.Cookies["cookieName"].Value判斷cookie是否存在:if(HttpContext.Current.Request.Cookies["cookieName"
Time of Update: 2015-05-23
標籤: 下午在搞MVC和EXTJS的日期格式互相轉換遇到了問題,我們從.NET伺服器端序列化一個DateTime對象的結果是一個字串格式,如 ‘/Date(1335258540000)/‘ 這樣的字串。 整數1335258540000實際上是一個1970 年 1 月 1 日 00:00:00至這個DateTime中間間隔的毫秒數。通過javascript用eval函數可以把這個日期文字轉換為一個帶有時區的Date對象,如下 用var date = eval(‘new ‘ +
Time of Update: 2015-05-23
標籤:爬蟲 c# using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Net;using System.Text;using System.Text.RegularExpressions;using System.Threading.Tasks;namespace
Time of Update: 2015-05-23
標籤:c# servlet 需求通用訊息介面使用servlet作為伺服器端服務介面,第三方應用程式通過http post的方式調用servlet,實現與通用訊息介面的調用串連。 參數說明如下: msgTitle:訊息標題,描述發送訊息的標題 serviceId:服務編號,訊息的服務編號 msgDesp:訊息描述,訊息的詳細內容 msgURL:URL地址,訊息中包含的 URL
Time of Update: 2015-05-23
標籤:
Time of Update: 2015-05-23
標籤: 1. System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName-擷取模組的完整路徑。2. System.Environment.CurrentDirectory-擷取和設定目前的目錄(該進程從中啟動的目錄)的完全限定目錄。3.
Time of Update: 2015-05-23
標籤:何謂匿名類,其實本質和普通定義的類一樣,只不過是由系統的編譯器來完成的,首先舉個例子。一般情況//聲明一個類,包含貼別多的欄位public class Person(){ public string Name{set;ge;} public int Age{set;get;} . . . .
Time of Update: 2015-05-23
標籤:gcc linux 編譯 彙編 連結 在c語言中編寫“hello world!” 程式基本成了每個學習過c語言的人必寫的程式之一,點擊運行,(如果沒錯的話)就會在黑框裡面顯示 hello world!在LInux 下使用 gcc 來編寫 "hello world!"