Programming - cpueblo.com

Visual Basicⓡ처럼 property 다루기


글쓴이 : 유광희 날짜 : 2002-05-13 (월) 16:57 조회 : 6944
#include <stdio.h> class CGoodExample { public: __declspec(property(get=GetID, put=PutID)) int id; int GetID() const { printf("GetID() called\\n"); return m_iID; } void PutID(int iID) { printf("PutID() called\\n"); m_iID = iID; } private: int m_iID; }; int main(int argc, char* argv[]) { CGoodExample ge; ge.id = 3; printf("ID of = %d\\n", ge.id); printf("sizeof(ge) = %d\\n", sizeof(ge)); return 0; }