comparing two objects

I couldn't find where is the problem in this comparison.
It always display on MAC :
Segmentation fault : 11
The two objects contains strings(words) picked up from two different files.
and want to compare these two objects if they are similar, or contains the same words
main cpp file
UseData.cpp
 
result = (myData1 == myData2);

My Header Data.h
 
friend bool operator==(const Data& d1, const Data& d2);

Data.cpp
1
2
3
4
5
6
bool operator==(const Data& d1, const Data& d2){	
	if(d1==d2)
		return true;  
	else
		return false;
}


I know the problem is coming from [if(d1==d2)]
but i don't see how to fix it !
Last edited on
The operator == function is calling itself recursively until the stack is exhausted.
if(d1==d2) should be doing something with the member variables within the two Data objects.
Topic archived. No new replies allowed.