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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:46:04+00:00 2026-06-05T18:46:04+00:00

It would be convenient to be able to specify a class object by its

  • 0

It would be convenient to be able to specify a class object by its name rather than sending the class message to it. The runtime already knows what the id of the class is so why should I go through the trouble of sending a message each time to retrieve this?

My guess is that the compiler will optimize it so that this doesn’t actually cause a message to be sent.

There must be some good reason (which I seek) that explains why the syntax must be this way.

  • 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-05T18:46:05+00:00Added an answer on June 5, 2026 at 6:46 pm

    That’s how it’s designed to work: the class name is a type. Objects are pointers to that type. And a tpye alone can’t be used as a value (constant, variable, expression, whatever you want to use it as…). If it’s inconvenient for you (euh, it sholdn’t be!), you can come up with a few workarounds: for eample, define a short macro:

    #define C(name) [name class]
    

    or

    #define C(name) objc_getClass(#name)
    

    Hope this helps.

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

Sidebar

Related Questions

Would anyone be able to tell me how to pull the server name out
I look at a lot of small Java programs. It would be convenient if
Would it be possible to add a new operator to the String class that
Would like to be able to set colors of headings and such, different font
I would like to be able to use Spring using setter injection into Scala
I am creating a multi-plot layout illustration using R, and it would be convenient
I would like my client to be able to order items in the backend.
It just crossed my mind that it would be extremely nice to be able
I want to be able to instantiate any object in my application with this
Being able to define an array e.g. int a[] = {1,2,3}; is very convenient,

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.