Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
June 21, 2018, 08:41:05 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: Informal Protocol interface and implementation  (Read 3198 times)
amuso
Jr. Member
**
Posts: 68


Hope to make a living coding...

amuso@scw.net
« on: November 04, 2009, 04:56:57 AM »

I was wondering if this is the correct way to write the informal protocol interface and implementation.

Code: (Objective-C)
// Sample Fraction.h interface file

@interface Fraction : NSObject {
int numerator;
int denominator;
}

-(void) print;
-(void) setTo: (int) n over: (int) d;

@end

@interface Fraction (NSComparisonMethods)
-(BOOL) isEqualTo: (id) f;
-(BOOL) isLessThan: (id) f;
@end

Or should I somehow merge these two @interface sections into one to avoid two @end statements ? If so, how is that best done ? Should I perhaps create another set of interface/implementation files called FractionNSComparison.h & .m ?
Logged

MacBook MB063 4GB OS X 10.7.3 (Xcode 4.3)
iMac MA876 3GB OS X 10.7.3
iPhone 4S 16GB 5.0.1 / iPad 2 16GB 5.0.1
Need translations to Norwegian? Happy to help.
skochan
Administrator
Hero Member
*****
Posts: 3114



« Reply #1 on: November 04, 2009, 12:15:24 PM »

I think this post will answer your question:  http://classroomm.com/objective-c/index.php?topic=2408.0

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.