View Single Post
Old 06-12-2002, 11:12 AM   #9 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,726
redhead is on a distinguished road
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 */}
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote