| //重载隐式转换操作符 operator ValueType() { assert(m_cObject != NULL); assert(Get != NULL); return (m_cObject->*Get)(); } private: Container* m_cObject; //属性的拥有者 void (Container::*Set)(ValueType value); //set函数指针 ValueType (Container::*Get)(); //get函数指针 }; class CAdoConnection { public: CAdoConnection(); ~CAdoConnection(); //隐式的转换操作,不推荐使用,只是暂时类没有封装好,给客户一个方便 //使用时请确保指针在类的生命期内使用 operator _ConnectionPtr(); public: CProperty<CAdoConnection, BOOL, READ_WRITE> Connected; string ConnectingString; string UserName, PassWord; private: void SetConnected(BOOL ConnectFlag); BOOL GetConnected(); private: _ConnectionPtr m_ptrConn; friend class CAdoCommand; friend class CAdoQuery; }; class CAdoCommand { public: CAdoCommand(); ~CAdoCommand(); void Execute(); operator _CommandPtr(); public: CommandTypeEnum CommandType; string CommandText; CAdoConnection * m_AdoConnection; private: _CommandPtr m_ptrComm; }; //CAdoConnection CAdoConnection::CAdoConnection() { Connected.setContainer(this);&nbs 上一页 [1] [2] [3] [4] [5] 下一页 |