#include "stdafx.h"
typedef unsigned int HANDLE;
class CHandle
{
private:
HANDLE m_handle;
int m_data;
public:
CHandle() //생성자
{
m_handle=0; //return
m_data =1;
}
//HANDLE GetHandle() const
//{
// printf("GetHangle()\n");
// return m_handle;
//}
//CHandle 타입의 객체가 HANDLE로 타입 변환(type conversion)
operator HANDLE() const
//변환 연산자 함수의 리턴 타입이 operator
//뒤에 명시됨을 주의 / 리턴 타입 자리는 반드시 비워둔다.
{
printf("operator HANDLE()\n");
return m_handle;
}
void FromHandle(HANDLE handle)
{
m_handle = handle;
//contruct etc. members from handle
}
}; //Class CHandleMap
void Test(HANDLE handle)
{
printf("handel = %i\n",handle);
}//test()
void main()
{
CHandle handleObject;
HANDLE handle;
handle =2;
handleObject.FromHandle(handle);
//Test(handleObject.GetHandle());
Test(handleObject);
char i;
scanf("%c",&i);
//Test(handleObject;
}//Main()