• Source
    1. #import <objc/objc.h>
    2. #import <objc/Object.h>
    3. #import <Foundation/Foundation.h>
    4.  
    5. @interface TestObj : Object
    6. {
    7. //none
    8. }
    9. - (void)testMethod;
    10. @end
    11.  
    12. @implementation TestObj
    13. - (void)testMethod {
    14. //an example of a string declaration using NSString type
    15. NSString *string1=[NSString stringWithFormat:@"Hello"];
    16.  
    17. //printing a formatted output containing a string variable and a string value
    18. printf("%s %s", [string1 UTF8String],"World");
    19. }
    20.  
    21. int main()
    22. {
    23. id obj = [[TestObj alloc] init];
    24. [obj testMethod];
    25. return 0;
    26. }
    27. @end