I haven't checked, but I suspect the compiler chooses the right thing, since this is only a warning. Maybe someone knows a way to disable the warning? In Java, I wouldn't be surprised if there were a way to enable a similar warning.

--Andy

On Jan 9, 2009, at 9:59 AM, Sandro Noel wrote:

the compiler is complaining just because they all have the same name and he is confused about witch to choose....
to resolve the issue, just rename the parameters of your procedure.

IE: - (id)initWithLabel:(NSString *)initLabel pin:(NSString *)initPin seed:(NSString *)initSeed {

or whatever name that makes them different than your classe's definition.

Sandro Noel..


On 9-Jan-09, at 2:49 AM, nik heger wrote:

I am trying to define a pure data object in Cocoa. This object doesn't do anything, it should just act as a container for three strings. This is generally a good design pattern, at least in Java.

In Cocoa, I am running into a lot of resistance. The constructor is rather complicated.

And the compiler complains about this:

- (id)initWithLabel:(NSString *)label pin:(NSString *)pin seed: (NSString *)seed {
        if (self = [super init]) {
                self.label = label; ///<----------- compiler complains
                self.pin = pin;
                self.seed = seed;
        }
        return self;    
}

I get three warnings that say "local declaration of x overrides instance variables. I thought I could differentiate between the parameters and the instance variables using self.variable vs just variable.

What's the Cocoa way of doing this? Do I really have to name the parameters pLabel, pSeed, and pPin? Or would it be better to just keep that stuff in a Dictionary object?

Thanks for any help,

        Nik
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/sandro.noel %40mac.com

This email sent to sandro.n...@mac.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/aglee%40mac.com

This email sent to ag...@mac.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to