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

  • Home
  • SEARCH
  • 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 8123829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:17:26+00:00 2026-06-06T06:17:26+00:00

I am learning object orientated programming from the online Stanford courses there is a

  • 0

I am learning object orientated programming from the online Stanford courses there is a part I am unsure of regarding declarations. I thought that you must always declare the prototype in the header and then write the code in the implementation file, but the professor wrote a method in the implementation without a declaration prototype in the header file, how come?

Also, may someone please clear the difference between private and public and if the method without a prototype is public or private? The method without a prototype is not from a super class.

  • 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-06T06:17:27+00:00Added an answer on June 6, 2026 at 6:17 am

    That is a perfectly legal way to declare methods that are not to be used outside the class implementation itself.

    The compiler will find methods in the implementation file as long as they precede the method in which they are used. However that will not always be the case, as the new LLVM compiler allows methods to be declared in any order and referenced from a given file.

    There are a couple of different styles for declaring methods inside an implementation file:

    //In the Header File, MyClass.h
    @interface MyClass : NSObject
    @end
    
    //in the implementation file, MyClass.m
    //Method Decls inside a Private Category
    @interface MyClass (_Private)
        - (void)doSomething;
    @end
    
    //As a class extension (new to LLVM compiler)
    @interface MyClass ()
        - (void)doSomething;
    @end
    
    @implementation MyClass
    //You can also simply implement a method with no formal "forward" declaration
    //in this case you must declare the method before you use it, unless you're using the
    //latest LLVM Compiler (See the WWDC Session on Modern Objective C)
    - (void)doSomething {
    }
    
    - (void)foo {
        [self doSomething];
    }
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm learning JS prototypes. From Java language point I expect,that SpecificRectangle object will have
I am currently learning Object oriented Javascript but it seems that the alert is
Learning a lot in my few years of programming that the best projects are
I am designing an object-oriented programming language for the purpose of learning. The language
I have just started learning the concept of Object oriented programming and have put
I am learning Object Oriented Programming, but I am confused about abstract class and
So, I've taken a handful of programming courses(object-oriented, web) but never had hands-on projects
I'm new to object oriented programming and am slowly learning how to apply it
From day 1 of my programming career, I started with object-oriented programming. However, I'm
I have recently started coding in php again and am learning Object Orientated PHP.

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.