objc++.mm 591 B

12345678910111213141516171819202122
  1. #import <iostream.h>
  2. #import <Cocoa/Cocoa.h>
  3. int main()
  4. {
  5. NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  6. NSMutableSet *mySet = [NSMutableSet set];
  7. cout<<"Adding values to the set."<<endl;
  8. [mySet addObject:[NSNumber numberWithInt:356]];
  9. [mySet addObject:[NSNumber numberWithInt:550]];
  10. [mySet addObject:[NSNumber numberWithInt:914]];
  11. cout<<"The set contains "<<[mySet count]<<" objects."<<endl;
  12. if ([mySet containsObject:[NSNumber numberWithInt:911]])
  13. cout<<"It's there!"<<endl;
  14. else
  15. cout<<"It's not there."<<endl;
  16. [pool release];
  17. return 0;
  18. }