Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Overloading function defenitions

konstantin_shiriazdanov
konstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
Is there an opportunity to overload user defined functions for several types of arguments? For example for ValueWithUnits and Vector types?

Comments

  • NeilCooke
    NeilCooke Moderator, Onshape Employees Posts: 6,099 image
    You can, but it's also just as easy to specify no type in the function declaration and then test the type within the function. 
    Senior Director, Technical Services, EMEA
  • konstantin_shiriazdanov
    konstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    @NeilCooke I'd like to test perfomance for if operator vs function overloading, so i should just add another function with the same name for another type of argument?
  • NeilCooke
    NeilCooke Moderator, Onshape Employees Posts: 6,099 image
    edited August 2017
    Yes that will work
    Senior Director, Technical Services, EMEA