# Public static function (am I doing something bad?)

**URL:** <https://forum.kirupa.com/t/public-static-function-am-i-doing-something-bad/42967>\
**Category:** Uncategorized\
**Created:** [February 15, 2004, 8:26am UTC](https://forum.kirupa.com/t/public-static-function-am-i-doing-something-bad/42967 "2004-02-15T08:26:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![findapollo](https://avatars.discourse-cdn.com/v4/letter/f/ea5d25/32.png) [@findapollo](https://forum.kirupa.com/u/findapollo)\
**Post date:** [February 15, 2004, 8:26am UTC](https://forum.kirupa.com/t/public-static-function-am-i-doing-something-bad/42967/1 "2004-02-15T08:26:47Z")

</div>

Ok, this is related to some 3D classes I’m writing, but don’t be afraid, you don’t need to understand how it works, I just need to understand why a parameter to a method is getting overwritten.

I have a class vector {}:  
with a public function for multiplying by a matrix:

```auto
public static function mult (M:matrix, V:vector):vector {}

```

the problem is that inside the function i need to create a new vector instance for the result to return:

```auto
var R:vector = new vector();

```

after I do that, the vector V that was passed in get’s overwritten  
(as if the constructor was called again with no params)

I do the same thing in the matrix class but it works fine  
(actually pass in two matrixes and neither get’s overwritten)

Please check out the source to see it happen in action.
