Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
June 21, 2018, 08:41:53 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register Chat  
Pages: [1]   Go Down
  Print  
Author Topic: About implement methods in category!  (Read 1784 times)
diuming
Newbie
*
Posts: 8


Email
« on: May 04, 2010, 06:53:17 AM »

You don't need to implement all the methods in a category (P230).

I just implement an add method in category, But I get two warning messages in Code.

(1)warning: incomplete implementation of category 'Math'
(2)warning: method definition for '-sub:' not found

How about these warning message, Is it important or not?

#import <Cocoa/Cocoa.h>
#import "Fraction.h"

@interface Fraction (Math)

- (Fraction *)add:(Fraction *)f;
- (Fraction *)sub:(Fraction *)f;

@end

#import "FractionMath.h"

@implementation Fraction (Math)

- (Fraction * )add:(Fraction *)f {
   
   Fraction * result = [[Fraction alloc] inti];
   [result setTo:(numerator * [f denominator]) + (denominator * [f numerator])
          over:denominator * [f denominator]];
   
   return result;
}

@end
Logged
skochan
Administrator
Hero Member
*****
Posts: 3114



« Reply #1 on: May 04, 2010, 07:05:50 AM »

They're just warnings.  That means the program can still be successfully compiled and run.

Cheers,

Steve Kochan
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents ゥ 2009 classroomM.com. All rights reserved.