Quote:
Originally posted by mmilano
what exactly does overloading mean?
|
A small example:
Code:
class someclass{
String name;
public:
void someclass() { name="";};
void someclass(String Name=""){name=Name;};
};
The create function for someclass is overloadet, so if you use:
Code:
int main(){
someclass test;
someclass test1("new class");
return 0;
}
Then in test1 case, it will use the second create function in someclass, thus assigning the name variable to "new class" the same thing is possible with allready created functions like
cout you just need to create it as an
operator to the given class you're creating, for the
cout << it would be
cout::operator << { /* what ever to do */}