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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:21:03+00:00 2026-05-23T20:21:03+00:00

I have a superclass Question: import <Foundation/Foundation.h> #import Answer.h @interface Question : NSObject {

  • 0

I have a superclass Question:

import <Foundation/Foundation.h>
#import "Answer.h"

@interface Question : NSObject {
    NSString* qId;
    NSString* qTitle;
    NSString* qNumber;  
    NSString* sectionId;
    NSString* type;
    Answer* answer;
}

@property (nonatomic, retain) NSString* qId;
@property (nonatomic, retain) NSString* qTitle;
@property (nonatomic, retain) NSString* qNumber;
@property (nonatomic, retain) NSString* sectionId;
@property (nonatomic, retain) NSString* type;
@property (nonatomic, retain) Answer* answer;

@end


#import "Question.h"

@implementation Question
@synthesize qId, qTitle, qNumber, sectionId, type, answer;

-(id)init
{
    if (self = [super init])
    {
        // Initialization code here
        answer = [[Answer alloc]init];
    }
    return self;
}

-(void) dealloc{
    [answer release];
    [super dealloc];
}

@end

I have several types of Question, one example is a Slider Question. I want this class to subclass Question:

#import <Foundation/Foundation.h>
#import "Question.h"

@interface SliderQuestion : Question {
    (NSString*) min;
    (NSString*) max;
}

@property (nonatomic, retain) NSString* min;
@property (nonatomic, retain) NSString* max;

@end
}

#import "SliderQuestion.h"

@implementation SliderQuestion

@synthesize min, max;

@end

Is this the correct way to subclass? Will SliderQuestion inherit the properties contained within Question?

SliderQuestion* s = [[SliderQuestion alloc]init];
NSLog(@"%@", s.qId); //is this valid
  • 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-23T20:21:04+00:00Added an answer on May 23, 2026 at 8:21 pm

    Do you really want min and max to be instances of NSString? It seems that floats would be more appropriate.

    Also, scrap the () in (NSString *) to remove the warning/error message.

    Finally, this is the appropriate way to subclass. An instance of SliderQuestion will inherit all properties and methods of the Question class (and NSObject as well)

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

Sidebar

Related Questions

Let's say I have the following headers: @interface SuperClass : NSObject @interface SubClass :
I have a superclass of type Question which has multiple subclasses (e.g. MultipleChoiceQuestion and
I have an abstract superclass with a property that must be set by the
[Updated]: Answer inline below question I have an inspecting program and one objective is
If I have a superclass, say Animal , and two subclasses: Zebra and Giraffe
I have an AbstractEntity class as superclass for all my entites that defines an
I have some classes which extends a superclass, and in the JSP I want
I have a table of electronic devices that serves as a generic superclass and
I have this object which is an instance of a superclass. I want to
I have an object of a subclass extending its superclass. There is an overridden

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.