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

The Archive Base Latest Questions

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

Here is what i want to do.. I have a class called userInfo. I

  • 0

Here is what i want to do..
I have a class called userInfo. I create an instance of this object in another class called LoginInfo. I want to keep this instace alive and accessible to all other classes and till the time the application is alive…

How do i achieve this? I read somewhere that i can do this with singleton classes. But i have no idea what they are…I am quite new to cocoa..Please guide..

Thanks in advance..


@interface UserInfo : NSObject {
    NSString * firstName;
    NSString * lastName;
    NSString * uID;
    NSString * password;
    NSString * userType;

}

-(id)initWithFirstName:(NSString *)fname andLastName:(NSString *)lname andUID:(NSString *)userID andPassword:(NSString *)pwd andUserType:(NSString *)type;
@property (readwrite, copy) NSString * firstName;
@property (readwrite, copy) NSString * lastName;
@property (readwrite, copy) NSString * uID;
@property (readwrite, copy) NSString * password;
@property (readwrite, copy) NSString * userType;

@end



#import "UserInfo.h"


@implementation UserInfo

-(id)initWithFirstName:(NSString *)fname andLastName:(NSString *)lname andUID:(NSString *)usid andPassword:(NSString *)pwd andUserType:(NSString *)type{
    self=[super init];
    if (self) {
        self.firstName=fname;
        self.lastName=lname;
        self.uID=usid;
        self.password=pwd;
        self.userType=type;
        }
    return self;
}

@synthesize firstName;
@synthesize lastName;
@synthesize uID;
@synthesize password;
@synthesize userType;


@end

This is the class i want to make singleton…. Please guide as to what changes i have to make..I want to use the custom constructor…
M sorry to put this code as an answer. But i could not get it in a comment…

  • 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-19T22:21:23+00:00Added an answer on May 19, 2026 at 10:21 pm

    What a Singleton is:
    Yeah.. I know.. I'm a simpleton.. So what's a Singleton?

    How to implement it in Objective-C:
    What should my Objective-C singleton look like?

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

Sidebar

Related Questions

I have a class called EditMapUtilities. Here are some class properties that I want
I have a question... I want to create a class called thumb w/ all
I have this html code that i want to edit with jQuery. Here is
I have a Ruby class called LibraryItem . I want to associate with every
I have a little class called Stuff that I want to store things in.
Here's the situation. Let's say I have a class called MYFoo. Here's it's initializer:
Here's an overview of my problem: I have a templated class called TWMatrix. I've
Here's what I'm thinking. So lets say I have a class called intro and
I work for a travel agency, they have a website, from here they want
Here's the scenario: I have a set of buttons that I want to bind

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.