Question

I have written code such as the following, which by assumption shouldn't compile. I'm assuming that it shouldn't compile because the instance methods are not declared in the interface. Is this necessary, either way what's the logic behind it?

Thanks :-)

@interface Foo: NSObject
{

}
@end

@implementation Foo
    -(void) blank 
    {
        NSLog(@"Hey this works");
    }
    -(void) foo
    {
        NSLog(@"Strange");
    }
@end
Was it helpful?

Solution

What is the question here? This code compiles just fine as methods do not need to be declared in the interface.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top