I want to create a wrapperClass for strings. I also want the class to be able to return the address of the wrapperClass and the address of the stored (wrapped) string:
void FunctionString(string*);
void FunctionWrappedString(wrappedString*);
int main(){
wrappedString wrappedStringObject;
FunctionString(&wrappedStringObject);
FunctionWrappedString(&wrappedStringObject);
wrappedString anotherWrappedStringObject;
if(wrappedStringObject == anotherWrappedStringObject){
// code
}
}
Here are the important parts of the class:
class wrappedString{
typedef char* string;
string storedString;
operator string*(){
// some code
return &storedString;
}
operator wrapperString*(){
// some code
return this;
}
operator string(){
// some code
return storedString;
}
}
However these fail when I use the comparison operator:
if(wrappedStringObject == anotherWrappedStringObject){
// code
}
Saying that the candidates are: operator==(string,string) and operator==(string*,string*)