Add copy assignment, constructor, destructor
This commit is contained in:
		
							parent
							
								
									b2e051a633
								
							
						
					
					
						commit
						ba91c8956a
					
				@ -11,7 +11,7 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
SingleList::SingleList(const SingleList& rhs)
 | 
					SingleList::SingleList(const SingleList& rhs)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  head = rhs.head;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@ -22,6 +22,8 @@ SingleList::SingleList(const SingleList& rhs)
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
SingleList& SingleList::operator=(const SingleList& rhs)
 | 
					SingleList& SingleList::operator=(const SingleList& rhs)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  makeEmpty();
 | 
				
			||||||
 | 
					  head = rhs.head;
 | 
				
			||||||
  return *this;
 | 
					  return *this;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -30,6 +32,7 @@ SingleList& SingleList::operator=(const SingleList& rhs)
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
SingleList::~SingleList()
 | 
					SingleList::~SingleList()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  makeEmpty();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/******************************************************************************
 | 
					/******************************************************************************
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user