// //  C++クラステスト // // 1999/ 2/ 6 宍戸 輝光 // #include class Test { private: int a,b; public: Test() { // コンストラクタ a=0; b=0; } int getA(void) { return a; } int getB(void) { return b; } void setA(int v) { a=v; } void setB(int v) { b=v; } }; int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow){ Test test; LPTSTR lpStr; test.setA(1); // testオブジェクトのaに値を代入 test.setB(2); // testオブジェクトのbに値を代入 lpStr=(LPTSTR)GlobalAlloc(GPTR,16); // testのa, bを取得し文字列化 wsprintf(lpStr,"a=%d b=%d",test.getA(),test.getB()); MessageBox(NULL,lpStr,NULL,MB_OK); GlobalFree(lpStr); return 0; }