Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
December 10, 2018, 03:24:11 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
Author Topic: Informal Protocol interface and implementation  (Read 3423 times)
Jr. Member
Posts: 68

Hope to make a living coding...
« 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;


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

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 ?

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.
Hero Member
Posts: 3114

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

I think this post will answer your question:


Steve Kochan
Pages: [1]   Go Up
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 All rights reserved.