How to return an instance of a class?
I'm getting the following error:

    "warning: conflicting types for '-(Fraction *) add: (Fraction *) f;"

with the line:

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

Here is my header code:

      // Define the Fraction class
        
        @interface Fraction : NSObject {
        	int numerator;
        	int denominator;
        }
        @property int numerator, denominator;
        
        -(void) print;
        -(void) setTo: (int) n over: (int) d;
        -(double) convertToNum;
        -(void) add: (Fraction *) f;
        -(void) reduce;
        
        @end
    
    Here is my .m code:
    #import "Fraction.h"
    
    @implementation Fraction
    @synthesize numerator, denominator;
    -(void) print
    {
    	NSLog (@"%i / %i", numerator, denominator);
    }
    -(double) convertToNum
    {
    	if (denominator != 0)
    		return (double) numerator / denominator;
    	else
    		return 1.0;
    }
    -(void) setTo: (int) n over: (int) d
    {
    	numerator = n;
    	denominator = d;
    }
    
    
    -(void) reduce 
    {
    	int u = numerator;
    	int v = denominator;
    	
    	int temp;
    	
    	while (v != 0) {
    		temp = u % v;
    		u = v;
    		v = temp;
    	}
    	
    	numerator /= u;
    	denominator /= u;
    		
    }
    
    -(Fraction *) add: (Fraction *) f;
    {
    	// To add two fractions:
    	// a/b + c/d = ((a*d) + (b*c)) / (b *d)
    	// multiply the denominators
    	// then mulitply each numerator by the OPPOSITE
    	// denominator
    	
    	// result will store the result of the addition
    	Fraction *result = [[Fraction alloc] init];
    	int		resultNum, resultDenom;
    	
    	resultNum = numerator * f.denominator + denominator * f.numerator;
    	resultDenom = denominator * f.denominator;
    	
    	[result setTo: resultNum over: resultDenom];
    	NSLog(@"%i, %i", resultNum, resultDenom);
    	[result reduce]; // reduces the numerator and denominator
    	// as both are instance (classwide) variables
    	NSLog(@"%i is the result", result);
    	return result;
    }
    @end


How to return an instance of a class?
===

I'm getting the following error:

    "warning: conflicting types for '-(Fraction *) add: (Fraction *) f;"

with the line:

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

Here is my header code:

      // Define the Fraction class
        
        @interface Fraction : NSObject {
        	int numerator;
        	int denominator;
        }
        @property int numerator, denominator;
        
        -(void) print;
        -(void) setTo: (int) n over: (int) d;
        -(double) convertToNum;
        -(void) add: (Fraction *) f;
        -(void) reduce;
        
        @end
    
    Here is my .m code:
    #import "Fraction.h"
    
    @implementation Fraction
    @synthesize numerator, denominator;
    -(void) print
    {
    	NSLog (@"%i / %i", numerator, denominator);
    }
    -(double) convertToNum
    {
    	if (denominator != 0)
    		return (double) numerator / denominator;
    	else
    		return 1.0;
    }
    -(void) setTo: (int) n over: (int) d
    {
    	numerator = n;
    	denominator = d;
    }
    
    
    -(void) reduce 
    {
    	int u = numerator;
    	int v = denominator;
    	
    	int temp;
    	
    	while (v != 0) {
    		temp = u % v;
    		u = v;
    		v = temp;
    	}
    	
    	numerator /= u;
    	denominator /= u;
    		
    }
    
    -(Fraction *) add: (Fraction *) f;
    {
    	// To add two fractions:
    	// a/b + c/d = ((a*d) + (b*c)) / (b *d)
    	// multiply the denominators
    	// then mulitply each numerator by the OPPOSITE
    	// denominator
    	
    	// result will store the result of the addition
    	Fraction *result = [[Fraction alloc] init];
    	int		resultNum, resultDenom;
    	
    	resultNum = numerator * f.denominator + denominator * f.numerator;
    	resultDenom = denominator * f.denominator;
    	
    	[result setTo: resultNum over: resultDenom];
    	NSLog(@"%i, %i", resultNum, resultDenom);
    	[result reduce]; // reduces the numerator and denominator
    	// as both are instance (classwide) variables
    	NSLog(@"%i is the result", result);
    	return result;
    }
    @end

