namespace Lists
{
/* Предварительное объявление классов */
class AccountLinkedList ;
class Node ;
/* LinkedList — связанный список объектов Node */
class AccountLinkedList
{
public :
AccountLinkedList( ) { pHead = 0 ; }
void addNode( Node* pNode ) ;
Node* firstNode( ) { return pHead ; }
protected :
Node* pHead ;
} ;
/* Node — узел в связанном списке, указывающий на объект Account */
class Node
{
friend class AccountLinkedList ;
public :
Node( AccountLinkedList* pL , Account* pAcc )
{
pList = pL ;
pNext = 0 ;
pAccount = pAcc ;
pL -> addNode( this ) ;
}
static Node* firstNode( AccountLinkedList* pList )
{
return pList -> firstNode( ) ;