www.pudn.com > 1012.zip > Container.cpp


// Container.cpp: implementation of the CContainer class. 
// 
////////////////////////////////////////////////////////////////////// 
#include "stdafx.h" 
//#include "SCAD.h" 
#include "Container.h" 
 
#ifdef _DEBUG 
#undef THIS_FILE 
static char THIS_FILE[]=__FILE__; 
#define new DEBUG_NEW 
#endif 
 
////////////////////////////////////////////////////////////////////// 
// Construction/Destruction 
////////////////////////////////////////////////////////////////////// 
 
CContainer::CContainer() 
{ 
	m_nRefCount = 1; 
} 
 
CContainer::~CContainer() 
{ 
	 
} 
 
void CContainer::AddRef() 
{ 
	m_nRefCount++; 
} 
 
void CContainer::Release() 
{ 
	m_nRefCount--; 
	if (m_nRefCount <= 0) 
	{ 
		UnRef(); 
		delete this; 
	} 
	 
} 
 
void CContainer::UnRef() 
{ 
	m_nRefCount =1; 
}