You have to check each object and only add its value if is is of obj1
class.
int total = 0;
for (obj1 *t in arry1) {
if ([t class] == [obj1 class])
total += t.value;
}
Please note that it common to start class names with a capital letter. Also Obj1
would be a misleading name as it implies instance, not class.