Method

# Operator_Multiply

<div class="rst-class">

forsearch

</div>

Operator

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Used to overload the `*</api/language/operators/mathematical/x>` operator, providing custom functionality.

## Notes

Create an <span class="title-ref">Operator_Multiply</span> function in a class to specify the functionality of the `*</api/language/operators/mathematical/x>` operator for that class.

In the function, the `Self</api/language/self_keyword>` instance is the left operand and the other operand is passed as a parameter.

## Sample code

Using the Vector class (see `Operator Add</api/language/operators/operator_overloads/operator_add>`) with two `Integer</api/data_types/integer>` elements, x and y, we define an <span class="title-ref">Operator_Multiply</span> function that multiplies the sum of the `Self</api/language/self_keyword>` instance with the passed instance.

``` xojo
Function Operator_Multiply(rhs As Vector) As Integer
  Var a, b As Integer
  a = Self.x + Self.y
  b = rhs.x + rhs.y

  Return a * b
End Function
```

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`*</api/language/operators/mathematical/x>` operator; `Operator MultiplyRight</api/language/operators/operator_overloads/operator_multiplyright>` function.

</div>
