代码改变世界

随笔档案-2012年03月

指针内容的引用

2012-03-20 23:31 by 江上渔者, 257 阅读, 收藏,
摘要: int *ipX = new int; if (ipX!=NULL) { int & irX = *ipX; // 正确 delete ipX; ipX = NULL; }不仅可以引用变量,也可以引用指针的内容。 阅读全文

常对象指针

2012-03-20 22:58 by 江上渔者, 341 阅读, 收藏,
摘要: // 常量.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <iostream>using namespace std;class MyClass{private: int m_iX; static int m_iY;public: MyClass(){cout<<"1";} ~MyClass(){cout<<"2";} void setX(int iX){m_iX=iX;} void setY(int iY){m_iY=iY;} int getX 阅读全文

操作符重载

2012-03-20 21:33 by 江上渔者, 195 阅读, 收藏,
摘要: // 操作符重载.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <iostream>using namespace std;class MyClass{private: int m_iNum; char m_szText[128];public: MyClass() { m_iNum = 0; memset(m_szText, 0, 128); cout<<"1"; } MyClass(const MyClass &c) { m_iNum = ... 阅读全文

COM制作

2012-03-15 12:27 by 江上渔者, 237 阅读, 收藏,
摘要: 一、BCB1、File-》New-》Other...-》C++Builder Projects-》ActiveX-》ActiveX Library2、File-》New-》Other...-》C++Builder Projects-》ActiveX-》Automation Object3、View-... 阅读全文

COM调用

2012-03-15 12:04 by 江上渔者, 306 阅读, 收藏,
摘要: 一、BCB(1)导入模式1、Component-》Import Component...-》Import a Type Library-》...2、#include "xxx_TLB.h"3、调用CoInitialize(NULL);IxxxDisp xxx;xxx.BindDefault();xx... 阅读全文