   pass class as parameter?
  I wonder if it possible to pass a class as a parameter... and not just an instance of the class.I have an function that looks like this.It check if object "self" collide with an object with the same type as "other" from the list of objects called "otherList"   static public bool Collide(GameObject self,GameObject other,ObjectList otherList)   {  bool collide = false;  for (int i = 0; i < otherList.objectList.Count; i++)  { GameObject obj = (GameObject)otherList.objectList;if (obj.box.Intersects(self.box) && obj.Equals(other))    collide=true;else collide= false;  }  return collide;   }I wanna use this function like this (inside an object like player):if (Functions.Collide(this,Bullet ,MiniShmupGame.defaultObjectList))  this.destroyed=true;The function requires an instance of a class in argument "other", however i don't want to create an instance. I just want to pass in a class so the function can determine if the current "obj" in the loop is an instance of that class.Is this possible? :D
  Is this C#?   ;  You might want to look at Object.GetType(), and all of C#'s other reflection methods.   ;  Just to make their replies a little easier:static public bool Collide(GameObject self, Type other, ObjectList otherList){    foreach( GameObject obj in otherList.objectList )    {   if( !(obj is other) )  continue;   if( obj.box.Intersects(self.box) )return true;    }    return false;}This makes use of the C# keywords "foreach", "in", and "is", which I would recommend reading up on.To use this, you can do this:if( Functions.Collide( this, typeof(Bullet), MiniShmupGame.defaultObjectList ) )    destroyed = true;;  It sounds like you need generics. (Assuming this is C#)As far as I understand your question you could then simply define the function like this:static public bool Collide<T>(T self, ObjectList<T> otherList){...}and then call the function like this:if (Collide<GameObject>(self, otherList)){....}