// win32Test3.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <map>
#include <string>
using namespace std;
class CStyle
{
public:
CStyle()
{
printf("构造函数\n");
}
void DoSomeTing()
{
printf("做事了\n");
b = 3;
}
int b;
};
int _tmain(int argc, _TCHAR* argv[])
{
//1
typedef map<string,CStyle> __Style;
__Style* m_style = new __Style;
//自动初始代一个CStyle类
(*m_style)["aaa"].DoSomeTing();
printf("%d\n",(*m_style)["aaa"].b);
//2
typedef map<string,CStyle*> __Style2;
__Style2* m_style2 = new __Style2;
CStyle* pSy = new CStyle;
(*m_style2)["aaa"] = pSy;
//pSy->DoSomeTing();
(*m_style2)["aaa"]->DoSomeTing();
printf("%d",(*m_style2)["aaa"]->b);
//3
typedef map<string,CStyle> __Style3;
__Style3* m_style3 = new __Style3;
CStyle* pSy3 = new CStyle;
(*m_style3)["aaa"] = *pSy3;
//pSy3->DoSomeTing();
(*m_style3)["aaa"].DoSomeTing();
printf("%d",(*m_style3)["aaa"].b);
return 0;
}