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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:14:32+00:00 2026-06-09T12:14:32+00:00

I know usually, when you want to call a method on another object, you

  • 0

I know usually, when you want to call a method on another object, you do:

NewObject *object = [NewObject alloc]init];

[object callMethod];

But I created a class that isn’t an object itself meaning it doesn’t have properties or memory management. It has a couple methods that calculate some stuff.

From any other class, all I have to do is import the header for this class and do:

#import "MyClass.h"

[MyClass callMethod];

Why in this case do I not have to alloc init? It works just fine.

  • 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-09T12:14:33+00:00Added an answer on June 9, 2026 at 12:14 pm

    It sounds like you are trying to call a class method. These are methods which have been defined as:

    • +(void) myStaticMethod;

    instead of

    • -(void) myMethod;

    The plus sign indicates that the method does not use any fields, and thereby does not need to instantiate the object.

    In your example, “object” is an instance of a class “NewObject” which has been allocated memory and initialized. Where-as your example, “MyClass” is only a class which because it has static members declared as above, does not need to be instantiated.

    Class methods provide a nice way to combine a bunch of related functions into one place, rather than having them spread out in the regular namespace, as would usually be done in straight C. You can also have both class methods and instance methods in the same class, using the class ones when needed, and instantiating the class to use the instance ones when needed.

    EDIT: Changed terminology to refer to class methods instead of static methods.

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

Sidebar

Related Questions

So I know that Error inflating class usually is because of a missing or
I just want to know, we usually close streams at the end, but why
I know that helpers are usually for views/templates. But say I have a helper
I know that Phonegap has an event for back button, but it's only available
I have a public EJB class that I want accessible online as a web
I've written a test script that I usually call from a cygwin bash. This
I want to make two classes: an object and an object_manager, but I'm confused
I have written a method that accepts a TextWriter as an argument (Usually Console.Out,
I know this may seem quite basic to geeks. But I want to make
I'm making a method call which takes the results of another four method calls

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.