NSString inheritance

Posted by Stef on Stack Overflow See other posts from Stack Overflow or by Stef
Published on 2011-01-08T00:25:15Z Indexed on 2011/01/08 9:53 UTC
Read the original article Hit count: 143

Filed under:

Hi, I'm doing an useless thing for my first step in Obj-C

@interface String : NSString
{
  int m_isnull;
}

- (id) init;
- (int) isNull;
@end


@implementation String

- (id) init
{
 self = [super init];

  m_isnull=1;
  return self;
}

- (int) isNull
{
  return m_isnull;
}

@end

test :

String *a;

a=@"ok";

Works fine, but just 2 little questions
1) When I'm compiling I have this warning

warning: incompatible Objective-C types assigning 'struct NSString *', expected 'struct String *'

I don't know how to avoid it !?

2) a=@"ok" is a fastest way to initialize a string, but when I'm debugging, I don't stop by at my init constructor why ?

© Stack Overflow or respective owner

Related posts about objective-c