In that case will be useful to pass somehow classes as argument.
bool FindObject(class c)
{
for( int i = 0; i < objects.length(); i++ )
if( cast< c >( objects[ i ] ) !is null )
return true;
return false;
}
Or do more flexibly system, like this:
type - new class for storing information about type.
class MyClass
class MyClass : MyDerivedClass
MyClass obj;
type myType1 = typeof( MyClass );
type myType2 = typeof( obj );
type myDerivedType = typeof( MyDerivedClass );
Comparsion with operators ==, !=, <, >, <=, >= and is (equal to <=):
myType1 X myType2; true: ==, <=, >=, is; false: !=, <, >;
myType1 X derivedObj; true: !=, <=, <, is; false: ==, >, >=;
derivedObj X myType1; true: !=, >=, >; false: ==, <, <=, is;
This is can be implemented for now, if will be added possibility to pass class as parameter.
I can pass class name as string and resolve it in runtime (typeof("MyClass")), but this is not good practice, need checking in compile time.