Rename directories, fix assignment operator in singlelist
This commit is contained in:
		
							parent
							
								
									255ba5a291
								
							
						
					
					
						commit
						110ac83be8
					
				@ -19,7 +19,7 @@ int main()
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  std::cout << "Driver: \n";
 | 
					  std::cout << "Driver: \n";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  SingleList testList;
 | 
					  SingleList testList, test;
 | 
				
			||||||
  bool exit = false;
 | 
					  bool exit = false;
 | 
				
			||||||
  int choice = -1;
 | 
					  int choice = -1;
 | 
				
			||||||
  int val, key;
 | 
					  int val, key;
 | 
				
			||||||
@ -41,6 +41,7 @@ int main()
 | 
				
			|||||||
      std::cin >> val;
 | 
					      std::cin >> val;
 | 
				
			||||||
      std::cin.clear();
 | 
					      std::cin.clear();
 | 
				
			||||||
      testList.insert(val);
 | 
					      testList.insert(val);
 | 
				
			||||||
 | 
					      test = testList;
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case INSERTAT:
 | 
					    case INSERTAT:
 | 
				
			||||||
@ -67,6 +68,7 @@ int main()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    case PRINT:
 | 
					    case PRINT:
 | 
				
			||||||
      testList.print();
 | 
					      testList.print();
 | 
				
			||||||
 | 
					      test.print();
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case FIND:
 | 
					    case FIND:
 | 
				
			||||||
@ -42,11 +42,10 @@ SingleList::SingleList(const SingleList& rhs)
 | 
				
			|||||||
 * @param rhs SingleList object 
 | 
					 * @param rhs SingleList object 
 | 
				
			||||||
 * @return SingleList& A shallow copy of the rhs SingleList in the assignment
 | 
					 * @return SingleList& A shallow copy of the rhs SingleList in the assignment
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
SingleList SingleList::operator=(SingleList& rhs)
 | 
					SingleList SingleList::operator=(SingleList rhs)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (this == &rhs) return *this;
 | 
					  if (this == &rhs) return *this;
 | 
				
			||||||
  else head = rhs.head;
 | 
					  std::swap(head, rhs.head);
 | 
				
			||||||
 | 
					 | 
				
			||||||
  return *this;
 | 
					  return *this;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -22,7 +22,7 @@ class SingleList{
 | 
				
			|||||||
  public:
 | 
					  public:
 | 
				
			||||||
    SingleList() : head(NULL) {};
 | 
					    SingleList() : head(NULL) {};
 | 
				
			||||||
    SingleList(const SingleList& rhs);
 | 
					    SingleList(const SingleList& rhs);
 | 
				
			||||||
    SingleList operator=(SingleList& rhs);
 | 
					    SingleList operator=(SingleList rhs);
 | 
				
			||||||
    ~SingleList();
 | 
					    ~SingleList();
 | 
				
			||||||
    bool insert(int val);
 | 
					    bool insert(int val);
 | 
				
			||||||
    bool insert(int val, int key);
 | 
					    bool insert(int val, int key);
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user