IskindOf(.......)什么用
IskindOf(.......)什么用。 问题点数:20、回复次数:3Top
1 楼friendmine(亚东)回复于 2002-10-09 08:23:02 得分 15
来判断是不是某个类的实例或是其派生类的实例
class b;
class c : public b;
class d : bpulic c;
d a = new d();
d.Iskingof(b)? the answer is TRUETop
2 楼rivershan(阿门)回复于 2002-10-09 08:26:57 得分 5
CObject::IsKindOf
BOOL IsKindOf( const CRuntimeClass* pClass ) const;
Return Value
Nonzero if the object corresponds to the class; otherwise 0.
Parameters
pClass
A pointer to a CRuntimeClass structure associated with your CObject-derived class.
Remarks
Tests pClass to see if (1) it is an object of the specified class or (2) it is an object of a class derived from the specified class. This function works only for classes declared with the DECLARE_DYNAMIC or DECLARE_SERIAL macro.
Do not use this function extensively because it defeats the C++ polymorphism feature. Use virtual functions instead.
Example
See CObList::CObList for a listing of the CAge class used in all CObject examples.
// example for CObject::IsKindOf
CAge a(21); // Must use IMPLEMENT_DYNAMIC or IMPLEMENT_SERIAL
ASSERT( a.IsKindOf( RUNTIME_CLASS( CAge ) ) );
ASSERT( a.IsKindOf( RUNTIME_CLASS( CObject ) ) );
CObject Overview | Class Members | Hierarchy Chart
See Also CObject::GetRuntimeClass, RUNTIME_CLASS,CObject Class: Accessing Run-Time Class Information
--------------------------------------------------------------------------------
Send feedback to MSDN.Look here for MSDN Online resources.Top
3 楼he_zhidan(何志丹:www.dzlishi.net,www.vcshare.net)回复于 2002-10-09 08:37:15 得分 0
请不要用英文。Top
相关问题
- iskindof()的作用?谢谢
- 谁能告诉我IsKindOf是干什么的?看msdn糊涂了。
- const的用法及意义,如 BOOL IsKindOf (const CRuntimeClass *pClass ) const;如何解释
- 在“Win32 Realease”状态下,为什么语句: ASSERT(pDlg->IsKindOf(RUNTIME_CLASS(CDataAcquisitionDlg)));编译不能通过,而人家的机器上
- BOOL IsKindOf(const CRuntimeClass* pClass) const;
- _T有什么用?
- 用什么编JAVA,用java作什么?
- packed 有什么用?
- 分有什么用?
- 到底用什么?




