#pragma once


struct __declspec(novtable) __declspec(uuid("{655B0B32-7B02-495b-9172-C8C243FB7602}")) IObject
{
	virtual ~IObject() {}
	virtual void* QueryInterface(const GUID& ar_InterfaceGuid) = 0; 
};


template<typename TargetType> TargetType* object_cast(IObject* ar_SourceObject_) 
{ 
   if (!ar_SourceObject_) 
      return NULL; 
   return reinterpret_cast<TargetType*> ( ar_SourceObject_->QueryInterface(__uuidof(TargetType)) ); 
}; 


template<typename TargetType> TargetType& object_cast(IObject& ar_SourceObject) 
{ 
	return *reinterpret_cast<TargetType*> ( ar_SourceObject.QueryInterface(__uuidof(TargetType)) ); 
}; 
