클래스 오브젝트 Objc

#import <stdio.h>
#import <objc/Object.h>

@interface Test : Object
+ (void)Write;
- (id)init;
@end

@implementation Test
+ (void)Write {
    printf("I love you... so please do not love me.\n");
}
- (id)init {
    printf("You can be whatever.\n");
    return [super init];
}
@end

int main() {
    Class testClass = [Test class]; //Test 클래스 오브젝트를 testClass에 담는다.

    [testClass Write];   //Write Method를 호출한다.
    [[testClass new] free];
    [testClass free];

    return 0;
}

Share
이 글과 관련된 글
  1. [2009/11/20] 클래스 메소드 by 두목원숭이 (467)
  2. [2009/11/20] 가시성[접근자] by 두목원숭이 (311)
  3. [2009/11/20] 정적 클래스 by 두목원숭이 (413)
  4. [2009/11/20] 소멸자 [free] by 두목원숭이 (331)
  5. [2009/11/20] 생성자 [constructor] by 두목원숭이 (274)
Tag :

Leave Comments



T-NAVI