I'm taking the final version of the C++ course offered by my jr college, and up to this point I have had almost no trouble understanding and implementing what I've learned in class and in my book, however I'm having a hard time understanding overloading, weither be it function, or operator (espically operator).
I am not looking for a textbook def, or a google define, or anything of the sort. My main questions are what I'm having a hard time understanding.
1)My text book says that operator overloading does not allow the programmer to create NEW operators, but extend the def of pre-exisitng ones. I dont see how this is very useful being as the examples in the book (where the overloading functions are defined {take + as an example} are comparing data members such as the example below})
int operator+(const class1& obj1, const class1& obj2)
{
class1 objtemp;
objtemp = obj1.length + obj2.length;
return value;
}
The rest will posted in an addiontal detail, I am out of space.
2006-10-25
11:42:40
·
3 answers
·
asked by
D
4