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 7820365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:15:51+00:00 2026-06-02T07:15:51+00:00

In Stephen Kochan’s Objective-C book (I have the 3rd Edition), one init function returns

  • 0

In Stephen Kochan’s Objective-C book (I have the 3rd Edition), one init function returns Fraction * and one returns id:

-(Fraction *) initWith: (int) n: (int) d {
    self = [super init];
    if (self)
        [self setTo: n over: d];

    return self;
}

-(id) init {
    return [self initWith: 0 over: 0];
}

(it is on page 198 to 199 of the book). Why is that, and does it matter if both return Fraction * or both return id (or have init return Fraction * and initWith return id)? What are the side effects of doing so, if any?

  • 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-02T07:15:52+00:00Added an answer on June 2, 2026 at 7:15 am

    Init methods typically return the id type because they don’t necessarily return an object of the class they belong to.

    For instance, -[NSMutableArray init] actually returns a NSCFMutableArray object.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am learning objective-c and XCode using Stephen Kochan's book. For one of the
Hi, guys! Currently I'm reading a book Programming in Objective-C by Stephen Kochan. Actually
I am learning Objective-C using Stephen Kochan's excellent book Programming in Objective-C 2.0. I
I have just started learning Objective-C, I am reading Programming in Objective-C 3rd Edition
I came across this code in Stephen G Kochan's book, Programming in c. Is
I'm working my way through Stephan Kochan's book on Objective C and I've come
I'm learning ObjectiveC with Programming in Objective C by Stephen G Kochan and I'm
I am learning C from ' Programming in C' by Stephen Kochan . Though
On page 88 of Stephen Toub's book http://www.microsoft.com/download/en/details.aspx?id=19222 There is the code private BlockingCollection<T>
On page 33 of Stephen Toub's book http://www.microsoft.com/download/en/details.aspx?id=19222 There is the code var pings

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.