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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:07:04+00:00 2026-06-14T08:07:04+00:00

Is it acceptable/safe in Objective-C/Cocoa to wrapping the init method as follows: -(id)init {

  • 0

Is it acceptable/safe in Objective-C/Cocoa to wrapping the init method as follows:

-(id)init {
    if ((self=[super init])) {
         self.bar = [[Bar alloc] init];
    }
    return self;
}

-(id)initWithFoo:(Foo *)f {
    if ((self=[self init])) {
         self.foo = f;
    }
    return self;
}

Note the [self init] in initWithFoo.

perhaps this is a simple yes answer… seem obvious, but not standard?

  • 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-14T08:07:05+00:00Added an answer on June 14, 2026 at 8:07 am

    It’s certainly acceptable and safe. I’m not certain if it’s standard practice, but I don’t think it’s bad practice.

    Note: This is not overloading. Overloading refers to a very specific thing in C-like languages (particularly C++) where you have multiple functions with the same name, distinguished only by their numbers and/or types of parameters. A better term for this would probably be something like forwarding or wrapping.

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

Sidebar

Related Questions

Is it safe/acceptable practice to lock on a private field variable (instead of using
Is it acceptable to name a named constructor valueOf that may return null in
It seems that an acceptable answer to the question What is a method? is
Is the following code acceptable. That is, is this the right way to do
Is the following always acceptable code? It seems to work, but does it consistently
Is it considered an acceptable practice to use Modules instead of Classes with Shared
Is it acceptable for a J2EE container to provide an implementation that complies with
Is it acceptable to dynamically generate the total of the contents of a field
Which one is more acceptable (best-practice)?: namespace NP public static class IO public static
I am looking for an acceptable starting point for placing applications settings in a

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.