I have a custom class and am trying to create an operator overload function for =. Unfortunately the error I get does not point to a specific line or error I just get the following error.
unresolved external symbol "public: int __thiscall sequence::size(void)const " (?size@sequence@@QBEHXZ) referenced in function "public: void __thiscall sequence::operator=(class sequence const &)" (??4sequence@@QAEXABV0@@Z)
It is on file Sequence2.obj line 1. As that is not a file I edit, I am a little unsure what the error is in the function.
Sequence2.cpp
void sequence::operator=(const sequence & source)
{
if (size() <= source.size()) {
delete[] data;
data = new value_type[source.size()];
current_index = -1;
used = 0;
}
else {
delete[] data;
data = new value_type[source.size() * 2];
current_index = -1;
used = 0;
}
for (int i = 0; i < source.size(); i++)
{
data[i] = source.data[i];
used++;
current_index++;
}
}
The size function, just returns the size of the sequence. On the Main.cpp I just have the following.
sequence test; // A sequence that we’ll perform tests on
sequence test2;
test.insert(33);
test.insert(35);
test.insert(36);
test2 = test;