I want to create a merge function which appends a object to another object, the idea is that the vector which on object has shall be appended to the primary object and the function has to return the appended object.
class Test
{
public:
void merge(Test &);
private
vector<Test> vec;
};
Test::merge(Test &obj2)
{
vec.push_back(obj2); //push obj2 to vector
}
int main()
{
Test obj1;
Test obj2;
obj1.merge(obj2);
}