Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8302521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:18:43+00:00 2026-06-08T17:18:43+00:00

I am new to obj-c programming, I read Kochan’s book. here is code from

  • 0

I am new to obj-c programming, I read Kochan’s book.

here is code from book

-(void) add:(Fraction *) f 
{
  numerator = numerator *f.denominator + denominator * f.numerator
  denominator = numerator * f.denominator

}

I know the ‘f’ is point to Fraction, but I dont understand inside method that why using f.numerator or f.denominator.

Is anyone can explain it for me? my first language is not english. so please make it simple.

Edit :well,in math we using (a/b)+(c/d) =(ad+bc)/(bd), I know this formula. I just dont get it that why after asterisk why put f dot something.I want to know f point to where.

*EDIT*2

I still have litte problem about words in Parentheses which “(Fraction *)f”

In the book says “This says that argument to the add:method is a reference to an object from the Fraction class”

does the Fraction in that parentheses is point to Fraction class ? or the word “f” is point to Fraction class?

I dont understand this sentence. Can you give me more detail about that?

EDIT 3

inside add method. why using the just one f dot something?
I mean looks this

numerator = numerator *f.denominator + denominator * f.numerator

why we can not write code like this part.

numerator = f.numerator *f.denominator + f.denominator * f.numerator

I dont understand this part.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:18:45+00:00Added an answer on June 8, 2026 at 5:18 pm

    It appears to be a public property on the Fraction class. f is an instance of the Fraction class. numerator and denominator are public properties in the Fraction class. The dot notation is equivalent to [f numerator].

    EDIT

    Here is the rewritten code using the alternate message sending syntax.

    -(void) add:(Fraction *) f 
    {
      denominator = numerator * [f denominator];
      numerator = numerator * [f denominator] + denominator * [f numerator];
    }
    

    EDIT 2. The Fraction class header probably looks something like this.

    class Fraction : NSObject
    
    // methods
    // ...
    
    @property (nonatomic, strong) int numerator;
    @property (nonatomic, strong) int denominator;
    
    // other properties
    // ...
    
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new in Obj C programming, so i will start from beginning I have
I'm new to Obj-C/Cocoa programming, and I'm having an issue trying to dynamically add
I want to add new obj of JSON like: 128: { Msg: [{ me:
// // To Throw void PrintType(object obj) { if(obj == null) { throw new
I have a method -(void)myMethod:(MyObject*)obj And I am detaching a new thread [NSThread detachNewThreadSelector:@selector(myMethod)
private void btnSend_Click(object sender, RoutedEventArgs e) { Button obj=(Button)sender; obj.Content=Cancel; SendImage send = new
I am very new to obj-c (about 1 day) and i have read the
my protocol method isn't called ... i'm new in obj-c programming ... i have
Just getting started with Obj-C and iOS programming. I have some code that loads
I'm new in programming obj-c. So, when shall i release the defined objects? Do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.