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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:36:41+00:00 2026-05-23T02:36:41+00:00

The current status I have a superclass named GeneralCard that is the super of

  • 0

The current status
I have a superclass named “GeneralCard” that is the super of many “CardsControllers”.

Every class that inherits from “GeneralCard” has a different subclass of UIViewController that holds different NSManagedObjects subclasses –

(WhiteCardsController –>WhiteCard,
RedCardsController –> RedCard …).

I have a lot of functions that are actualy the same for all the managedObjects. so i want to group them in the general card.

The problem

I have created a “General” NSManagedObject called :

 NSManagedObject *currentCard.

Now on each View controller I am trying to cast :

self.currentCard = (WhiteCard*)self.currentCard;

So i will be able to use “WhiteCard” properties.

that dosent work as i keep getting errors like –

…Cards View
Controllers/WhiteCardViewController.m:226:
error: request for member ‘letter’ in
something not a structure or union

As letter is not structured in NSManagedObject but it does in his WhiteCard subclass.

To the question
*How can i share the same variable from the super but cast it differently on each vew controller ?*

Thanks a lot

shani

  • 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-05-23T02:36:42+00:00Added an answer on May 23, 2026 at 2:36 am

    I would write an accessor method for each child class that returns the typecast object. Something like:

    - (WhiteCard *)myTypeCurrentCard {
        return (WhiteCard *)self.currentCard;
    }
    

    The parent class would have something like:

    - (GenericCard *)myTypeCurrentCard {
        return (GenericCard *)self.currentCard;
    }
    

    Within each controller class with these methods, the message [self myTypeCurrentCard] would return a object cast to the current type. This method does not guarantee the resulting object is actually that type of object, so care must be taken to insure no runtime errors occur by sending non WhiteCard objects white card specific messages.

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

Sidebar

Related Questions

I have a background thread that is sending data about the application's current status
I am building a desktop application that needs to update current user's status frequently.
Current, I've got a stored procedure that has a main goal of doing a
I have a C++/Qt QThread worker thread, which stores its current status as an
I have designed a table called USER_REQUESTS . It has a field called STATUS
I have a form that displays a list of systems along with their current
In my application, I have specified a second activity that can be launched from
I have a template that displays the list of items. It has one checkbox
I have 'StatusBar' with 'StatusBarItem'`s and one of them is current status label. I
I'm looking for a feature that will allow me to see a current status

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.