Skip to content

Instantly share code, notes, and snippets.

@chandlerkent
Created February 23, 2010 02:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chandlerkent/311764 to your computer and use it in GitHub Desktop.
Save chandlerkent/311764 to your computer and use it in GitHub Desktop.
"Shadowed" should be alerted.
/*
* AppController.j
* ShadowingProblem
*
* Created by Chandler Kent on February 22, 2010.
* Copyright 2010, Your Company All rights reserved.
*/
@import <Foundation/CPObject.j>
@implementation AppController : CPObject
{
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask];
var childObject = [[ChildObject alloc] init];
[theWindow orderFront:self];
}
@end
// Parent Object
@implementation ParentObject : CPObject
{
}
- (void)doesThisParameterShadow:(CPString)variableToShadow
{
// This should be "Shadowed"
alert(variableToShadow);
}
@end
// Child Object
@implementation ChildObject : ParentObject
{
CPString variableToShadow;
}
- (id)init
{
self = [super init];
if(self)
{
variableToShadow = @"Not shadowed";
[self doesThisParameterShadow:@"Shadowed"];
}
return self;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment