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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:00:48+00:00 2026-06-13T09:00:48+00:00

So I want a class to be able to store a Class object, then

  • 0

So I want a class to be able to store a “Class” object, then later call the static methods of that class…

Basically I have multiple classes that inherit a single class, so they all have the same static methods (but return different things). I want to be able to store which subclass I am using so I know which one to call the static methods of…

I know I can get the class with

Class something = [VirginMobile class];

But I can’t then do something like int i = [something staticMethodReturningInt];

Is there any way I can do this?

Cheers

  • 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-13T09:00:49+00:00Added an answer on June 13, 2026 at 9:00 am

    I know you probably don’t want to hear that, but once you start being too clever with classes it’s a sure sign to use regular objects instead. I’m not sure if I understand your question correctly, but one way to solve issues with typing is to cast the receiver to id:

    id something = [VirginMobile class];
    int i = [something methodReturningInt];
    

    This will compile fine, as long as the compiler can see the definition of methodReturningInt. And of course, at runtime VirginMobile has to respond to +methodReturningInt.

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

Sidebar

Related Questions

I want to define a class that is able to populate itself reading from
So I want to be able to add/remove class methods at runtime. Before you
I have a C++ class MyObject and I want to be able to feed
I have an object I want to store in the IsolatedStorageSettings, which I wan't
I want to have a class that defines my parameter data for a stored
In Delphi, I want to be able to create an private object that's associated
I want the wrapper my_function to be able to receive either a class or
I'm creating a abstractFactory class and I want to be able to send the
I'm writing a matrix class and I want to be able to cast a
I derived ImageButton from Button class. I want to be able to set text

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.