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
in
Computers & Internet
➔ Programming & Design
2)How exactly is this usefull in the bussiness world, I realize that perhaps it would save programming time to explictly overload operators, but isn't the idea in the bussiness world ot keep programs as simple as possible so that you can pass the work on to someone else and they can understand it?
3)Any thing else i should know???I'm sorry this chapter has me very confused!!
2006-10-25
11:44:49 ·
update #1