岁月流转,往昔空明

C++博客 首页 新随笔 联系 聚合 管理
  118 Posts :: 3 Stories :: 413 Comments :: 0 Trackbacks
该类可用于支持游戏中的编辑器等需要使用变量名称字符串访问变量的功能。

使用示例如下:
// PropertyUtility.cpp : Defines the entry point for the console application.
// TestBase 与 TestDerived 是使用该支持库实作的两个例程类。

#include 
"stdafx.h"
#include 
"TestClass.h"
#include 
<iostream>

int _tmain(int argc, _TCHAR* argv[])
{
    TestBase tb;
    TestDerived td;
    
int x;
    
int y = 5;
    
    
//测试基本存取
    
//tb.Set(_T("testint3"), y); //warning:can't find property
    
//tb.Set(_T("testint"), float(y)); //assert: type-error
    tb.Set(_T("testint"), y); //"testint" = 5
    tb.Get(_T("testint"), x); // x = 5;
    
//td.Set(_T("testint"), x); //assert:not initialize;
    
    cout 
<< x << endl;
    system(
"pause");
    
return 0;
}
posted on 2006-09-30 12:12 空明流转 阅读(813) 评论(3)  编辑 收藏 引用

评论

# re: 实作的一个Property Class(1) -------- 使用示例 2006-09-30 15:49 钱胜荣
怎么我不能运行啊,提示有错误啊!  回复  更多评论
  

# re: 实作的一个Property Class(1) -------- 使用示例 2006-09-30 17:31 空明流转
@钱胜荣
工程文件以及全部源代码在这里
http://blog.gameres.com/upload/sf_2006930134041.rar  回复  更多评论
  

# re: 实作的一个Property Class(1) -------- 使用示例 2006-10-03 21:18 shaker
关注下 用我的方法也比较不错 楼主多交流啊

http://www.cppblog.com/shaker/archive/2006/10/03/13281.html  回复  更多评论
  


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理