# Compare an instance to itself in its own method?

**URL:** <https://forum.kirupa.com/t/compare-an-instance-to-itself-in-its-own-method/263412>\
**Category:** flash\
**Created:** [June 15, 2008, 8:25pm UTC](https://forum.kirupa.com/t/compare-an-instance-to-itself-in-its-own-method/263412 "2008-06-15T20:25:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ILIKEYOUhttp](https://avatars.discourse-cdn.com/v4/letter/i/f0a364/32.png) [@ILIKEYOUhttp](https://forum.kirupa.com/u/ILIKEYOUhttp)\
**Post date:** [June 15, 2008, 8:25pm UTC](https://forum.kirupa.com/t/compare-an-instance-to-itself-in-its-own-method/263412/1 "2008-06-15T20:25:08Z")

</div>

How can I compare an instance, in this case in an array (eg myInstances[3]) to check whether it is itself in its own method.

Example (This is what I’ve been trying that hasnt been working):

Parent

```auto
myArray* = new Class;

...

myArray[j].checkSelf( myArray* );

```

Class

```auto
function checkSelf( a_instance ) : Boolean
{
if( a_instance == this ) return true;
}

```

Heeeeeeeeeeeeeeeeeeeeeeeeeeeeeelp:bounce:

---

<div class="post-metadata">

**Author:** ![ILIKEYOUhttp](https://avatars.discourse-cdn.com/v4/letter/i/f0a364/32.png) [@ILIKEYOUhttp](https://forum.kirupa.com/u/ILIKEYOUhttp)\
**Post date:** [June 16, 2008, 4:32pm UTC](https://forum.kirupa.com/t/compare-an-instance-to-itself-in-its-own-method/263412/2 "2008-06-16T16:32:28Z")

</div>

That was just an example code, mine acts based on whether it is true. I may dig it out if it keeps gving me problems.

I suppose I could run a loop in the parent class comparing all the instances and send the result or run based on the outcome (The array instances are grandchildren of the class I am running the method from). But I guess it doesn’t seem very elegant :stare: Thanks for the reply. Still open to suggestions, I’ll tryan out the loop idea and get back aswell
