_variant_t怎么当函数用呢
_variant_t是一个封装类,但是为什么可以当函数使用呢?例如m_pRecordset->PutCollect("Name",_variant_t(m_Name));...
_variant_t是一个封装类,但是为什么可以当函数使用呢?例如m_pRecordset->PutCollect("Name", _variant_t(m_Name));难道c++允许这样使用类吗?如果是类型转换的话,为什么不是(_variant_t)m_Name
展开
2个回答
展开全部
使用参数列表来构造对象啊 参考msdn
Construction
_variant_t Constructs a _variant_t object.
Microsoft Specific
_variant_t( ) throw( );
_variant_t( const VARIANT& varSrc ) throw( _com_error );
_variant_t( const VARIANT* pVarSrc ) throw( _com_error );
_variant_t( const _variant_t& var_t_Src ) throw( _com_error );
_variant_t( VARIANT& varSrc, bool fCopy ) throw( _com_error );
_variant_t( short sSrc, VARTYPE vtSrc = VT_I2 ) throw( _com_error );
_variant_t( long lSrc, VARTYPE vtSrc = VT_I4 ) throw( _com_error );
_variant_t( float fltSrc ) throw( );
_variant_t( double dblSrc, VARTYPE vtSrc = VT_R8 ) throw( _com_error );
_variant_t( const CY& cySrc ) throw( );
_variant_t( const _bstr_t& bstrSrc ) throw( _com_error );
_variant_t( const wchar_t *wstrSrc ) throw( _com_error );
_variant_t( const char* strSrc ) throw( _com_error );
_variant_t( bool bSrc ) throw( );
_variant_t( IUnknown* pIUknownSrc, bool fAddRef = true ) throw( );
_variant_t( IDispatch* pDispSrc, bool fAddRef = true ) throw( );
_variant_t( const DECIMAL& decSrc ) throw( );
_variant_t( BYTE bSrc ) throw( );
Construction
_variant_t Constructs a _variant_t object.
Microsoft Specific
_variant_t( ) throw( );
_variant_t( const VARIANT& varSrc ) throw( _com_error );
_variant_t( const VARIANT* pVarSrc ) throw( _com_error );
_variant_t( const _variant_t& var_t_Src ) throw( _com_error );
_variant_t( VARIANT& varSrc, bool fCopy ) throw( _com_error );
_variant_t( short sSrc, VARTYPE vtSrc = VT_I2 ) throw( _com_error );
_variant_t( long lSrc, VARTYPE vtSrc = VT_I4 ) throw( _com_error );
_variant_t( float fltSrc ) throw( );
_variant_t( double dblSrc, VARTYPE vtSrc = VT_R8 ) throw( _com_error );
_variant_t( const CY& cySrc ) throw( );
_variant_t( const _bstr_t& bstrSrc ) throw( _com_error );
_variant_t( const wchar_t *wstrSrc ) throw( _com_error );
_variant_t( const char* strSrc ) throw( _com_error );
_variant_t( bool bSrc ) throw( );
_variant_t( IUnknown* pIUknownSrc, bool fAddRef = true ) throw( );
_variant_t( IDispatch* pDispSrc, bool fAddRef = true ) throw( );
_variant_t( const DECIMAL& decSrc ) throw( );
_variant_t( BYTE bSrc ) throw( );
参考资料: msdn
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
不是强制转化,应该是构造一个对象
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询