Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

basic C++ question

Options
  • 04-09-2008 10:14pm
    #1
    Closed Accounts Posts: 12


    can * operator can be overloaded to perform division?


Comments

  • Registered Users Posts: 640 ✭✭✭Wcool


    why don;t you write a small program to test your questions?
    or are you following a written course in English???


  • Registered Users Posts: 2,379 ✭✭✭toiletduck


    can * operator can be overloaded to perform division?

    Yes.


    :pac:


  • Closed Accounts Posts: 5 unpure


    * operator is loaded to perform division by default, just include <cstdio>, <cstdlib> and <iostream>.
    Or do you mean used externally in runtime?
    (in which case yes)


  • Moderators, Science, Health & Environment Moderators Posts: 10,079 Mod ✭✭✭✭marco_polo


    For me the fact that anyone can, or would want to, change the meaning of the universal symbol of multipication (*) to be a division operator using operator overloading sums up everything that is wrong with the concept IMO. Nice idea but far too often misused in reality.


  • Registered Users Posts: 2,379 ✭✭✭toiletduck


    Personally I find it operator overloading invaluable. What's puzzling me is why the OP didn't try it out first before asking here....


  • Advertisement
  • Registered Users Posts: 2,494 ✭✭✭kayos


    toiletduck wrote: »
    Personally I find it operator overloading invaluable. What's puzzling me is why the OP didn't try it out first before asking here....

    Its called getting others to do his homework for him.


  • Registered Users Posts: 2,379 ✭✭✭toiletduck


    Man I wish I had homework as easy as that back in the day :pac:


  • Moderators, Science, Health & Environment Moderators Posts: 10,079 Mod ✭✭✭✭marco_polo


    toiletduck wrote: »
    Personally I find it operator overloading invaluable. What's puzzling me is why the OP didn't try it out first before asking here....

    Don't get me wrong used appropriatly it is a powerful and tool in a developers arsenal but quite regularly I have see it misused. Can you honestly say would you like to be the guy maintaining a codebase where a divided by b is written as a * b? No thanks :)


  • Closed Accounts Posts: 5 unpure


    * operator is loaded to perform division by default, just include <cstdio>, <cstdlib> and <iostream>.
    Or do you mean used externally in runtime?
    (in which case yes)

    EDIT: * is multiplication.
    My misread.


  • Registered Users Posts: 2,534 ✭✭✭FruitLover


    You can drive a car with your feet if you like. Doesn't make it a good idea.


  • Advertisement
Advertisement