Here are the errors
Binary.cpp: In function `std::istream& operator>>(std::istream&, binary&)':
Binary.cpp:24: error: `nodeType*binary::head_ptr' is private
Binary.cpp:114: error: within this context
Binary.cpp:24: error: `nodeType*binary::head_ptr' is private
Binary.cpp:115: error: within this context
Binary.cpp:115: error: call of overloaded `list_clear(nodeType*&)' is ambiguous
Binary.cpp:28: note: candidates are: void list_clear(nodeType*&)
Binary.cpp:56: note: void list_clear(nodeType*)
Binary.cpp:24: error: `nodeType*binary::head_ptr' is private
Binary.cpp:128: error: within this context
Binary.cpp:24: error: `nodeType*binary::head_ptr' is private
Binary.cpp:130: error: within this context
#include <iostream>
#include<cstdlib>
using namespace std;
struct nodeType
{
int info;
nodeType *link;
};
class binary
{
friend ostream& operator<<(ostream& outfile,const binary& outclass);
friend istream& operator>>(istream& infile, const binary& inclass);
friend binary& operator+(const binary& num1,const binary& num2);
public:
binary();
binary(const binary & inclass);
~binary();
const binary & operator =(const binary & otherlist);
int getcount() const;
private:
nodeType *head_ptr;
int count;
};
void list_clear(nodeType*&head_ptr);
void list_copy(const nodeType*source_ptr,
nodeType*&head_ptr, nodeType*&tail_ptr);
void resetlist(nodeType * &mylist);
binary::binary()
{
count = 0;
head_ptr = NULL;
}
binary::binary(const binary & inclass)
{
nodeType *tail_ptr;
list_copy(inclass.head_ptr, head_ptr, tail_ptr);
}
binary::~binary()
{
list_clear(head_ptr);
}
const binary & binary::operator =(const binary & otherlist)
{
}
int binary::getcount() const
{
return count;
}
void list_clear(nodeType*head_ptr)
{
nodeType *temp;
while(head_ptr != NULL)
{
temp = head_ptr;
head_ptr = head_ptr->link;
delete temp;
}
}
void list_copy(nodeType*&source_ptr, nodeType*&head_ptr, nodeType*&tail_ptr)
{
nodeType *temp;
head_ptr = NULL;
tail_ptr = NULL;
if(source_ptr == NULL)
return;
head_ptr = new nodeType;
head_ptr->link = NULL;
head_ptr->info = source_ptr->info;
tail_ptr = head_ptr;
source_ptr = source_ptr->link;
while(source_ptr !=NULL)
{
temp = new nodeType;
temp->link = NULL;
temp->info = source_ptr->info;
tail_ptr->link = temp;
tail_ptr = tail_ptr->link;
source_ptr = source_ptr->link;
}
}
void resetlist(nodeType * &mylist)
{
nodeType * templist;
nodeType * tempnode;
templist = NULL;
while(mylist != NULL)
{
tempnode = mylist;
mylist = mylist->link;
tempnode->link = templist;
templist = tempnode;
}
mylist = templist;
}
istream& operator>>(istream & infile, binary & inclass)
{
nodeType *newNode, *temp;
int numconv;
char ch;
temp = NULL;
inclass.head_ptr = NULL;
list_clear(inclass.head_ptr);
infile>>ws;
infile.get(ch);
while(infile && isdigit(ch))
{
numconv = ch -'0';//Converts the number to ASCII
newNode= new nodeType;
newNode->info = numconv;
newNode->link = NULL;
if(inclass.head_ptr == NULL)
{
inclass.head_ptr = newNode;
}
else
{
temp->link = newNode;
}
temp = newNode;
infile.get(ch);
}
infile>>numconv;
}
ostream& operator<<(ostream& outfile,const binary& outclass)
{
nodeType *newNode;
newNode = new nodeType;
newNode = outclass.head_ptr;
while(newNode != NULL)
{
outfile<<newNode->info<< " ";
newNode=newNode->link;
}
return outfile;
}
binary& operator+(const binary& num1,const binary& num2)
{
}