C/C++
tobyforever
这个作者很懒,什么都没留下…
展开
-
Timer Event Callback
// timeSimple.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "windows.h"#include "mmsystem.h"#pragma comment (lib,"winmm.lib")#define ONE_MILLI_SECOND 1 //原创 2009-04-03 02:29:00 · 720 阅读 · 0 评论 -
类的size & 私有成员的继承方式
#includeusing namespace std;class CParent{public: int m_Variable1; //size=4 (int) virtual void ShowVariable(){ //size=4(虚函数通过一个void pointer VPTR调用) coutm_Variable1 coutm_Variable2 };原创 2009-04-03 01:19:00 · 372 阅读 · 0 评论 -
虚函数 多态
/*用虚函数实现动态连接在编译期间,C++编译器根据程序传递给函数的参数或者函数返回类型来决定程序使用那个函数,然后编译器用正确的的函数替换每次启动。这种基于编译器的替换被称为静态连接,他们在程序运行之前执行。另一方面,当程序执行多态性时,替换是在程序执行期进行的,这种运行期间替换被称为动态连接。如下例子:*/#includeusing namespace std;//类声明及成员函数定义cla原创 2009-04-03 02:56:00 · 393 阅读 · 0 评论 -
数组名、数组名取地址以及作为函数传递带来的问题
// array_para.cpp : 定义控制台应用程序的入口点。////数组地址以及作为函数传递带来的问题 #include "stdafx.h"#include using namespace std;void test(int a[5]);void test2(int a[5]);int _tmain(int argc, _TCHAR* argv[]){ int a[5原创 2009-04-03 01:57:00 · 997 阅读 · 0 评论 -
ActiveDAQ控件的VC编程 数据采集 VARIANT数据类型的使用
// activetestDlg.cpp : implementation file//#include "math.h"#include "stdafx.h"#include "activetest.h"#include "activetestDlg.h"#include "stdafx.h"#include "windows.h"#include "mmsystem.h"#include "D原创 2009-04-03 02:44:00 · 1340 阅读 · 0 评论 -
内存分配方式(动态/静态)的不同对const变量(全局/局部)访问性的影响
// CONSTANT_StaticVsDynamic.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include using namespace std;const int const_var2=2; //GLOABAL const variable=>"static storage"in ROMint _tmain(int argc, _T原创 2009-04-03 01:05:00 · 503 阅读 · 0 评论 -
全局作用域符号(双冒号)例子
#include int count = 0; //全局变量 0void main() { int count = 10; //局部变量10 printf("count =%d/n",count);//局部变量屏蔽了全局变量 所以输出结果是10 { int count = 20; printf("count =%d/n",::count); //作用域符号指出引用全局原创 2009-04-03 03:00:00 · 1009 阅读 · 0 评论