mirror of https://github.com/nednal12/APLOC2.git
Final Commit
This commit is contained in:
parent
06ffe2b945
commit
8d1db02fb8
|
@ -23,6 +23,7 @@
|
|||
65DF924016C479840035C5C9 /* ChildFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = 65DF923F16C479840035C5C9 /* ChildFactory.m */; };
|
||||
65DF924316C49D240035C5C9 /* GoodChild.m in Sources */ = {isa = PBXBuildFile; fileRef = 65DF924216C49D240035C5C9 /* GoodChild.m */; };
|
||||
65DF924916C4A89C0035C5C9 /* BadChild.m in Sources */ = {isa = PBXBuildFile; fileRef = 65DF924816C4A89C0035C5C9 /* BadChild.m */; };
|
||||
65DF924C16C4AE670035C5C9 /* RottenChild.m in Sources */ = {isa = PBXBuildFile; fileRef = 65DF924B16C4AE670035C5C9 /* RottenChild.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
|
@ -51,6 +52,8 @@
|
|||
65DF924216C49D240035C5C9 /* GoodChild.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GoodChild.m; sourceTree = "<group>"; };
|
||||
65DF924716C4A89C0035C5C9 /* BadChild.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BadChild.h; sourceTree = "<group>"; };
|
||||
65DF924816C4A89C0035C5C9 /* BadChild.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BadChild.m; sourceTree = "<group>"; };
|
||||
65DF924A16C4AE670035C5C9 /* RottenChild.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RottenChild.h; sourceTree = "<group>"; };
|
||||
65DF924B16C4AE670035C5C9 /* RottenChild.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RottenChild.m; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
@ -112,6 +115,8 @@
|
|||
65DF924216C49D240035C5C9 /* GoodChild.m */,
|
||||
65DF924716C4A89C0035C5C9 /* BadChild.h */,
|
||||
65DF924816C4A89C0035C5C9 /* BadChild.m */,
|
||||
65DF924A16C4AE670035C5C9 /* RottenChild.h */,
|
||||
65DF924B16C4AE670035C5C9 /* RottenChild.m */,
|
||||
);
|
||||
path = "APLOC2 Week 1";
|
||||
sourceTree = "<group>";
|
||||
|
@ -204,6 +209,7 @@
|
|||
65DF924016C479840035C5C9 /* ChildFactory.m in Sources */,
|
||||
65DF924316C49D240035C5C9 /* GoodChild.m in Sources */,
|
||||
65DF924916C4A89C0035C5C9 /* BadChild.m in Sources */,
|
||||
65DF924C16C4AE670035C5C9 /* RottenChild.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
Binary file not shown.
|
@ -19,7 +19,7 @@ typedef enum
|
|||
|
||||
@interface Child : NSObject
|
||||
{
|
||||
@protected
|
||||
@public
|
||||
NSString *strName;
|
||||
int intChild;
|
||||
EChildType childType;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
-(void)showName
|
||||
{
|
||||
NSLog(@"My name is %@", strName);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,7 +35,7 @@
|
|||
|
||||
-(NSString*)showChild
|
||||
{
|
||||
NSString* returnThis = [[NSString alloc] initWithFormat:@"intChild = %d", intChild];
|
||||
NSString* returnThis = [[NSString alloc] initWithFormat:@"My name is = %@", strName];
|
||||
|
||||
|
||||
/* NSString* returnThis = [[NSString alloc] initWithFormat:@"blnChild = %c", blnChild];
|
||||
|
|
|
@ -21,6 +21,11 @@
|
|||
{
|
||||
return [[Child alloc] initWithDetails:1 inpStrName:@"Connor"];
|
||||
}
|
||||
else if (childType == 3)
|
||||
{
|
||||
return [[Child alloc] initWithDetails:3 inpStrName:@"Brent"];
|
||||
}
|
||||
|
||||
return nil;
|
||||
|
||||
}
|
||||
|
|
|
@ -15,5 +15,6 @@
|
|||
{
|
||||
intChild = 0;
|
||||
strName = @"Jack";
|
||||
childType = CHILDTYPE_GOOD;
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
//
|
||||
// RottenChild.h
|
||||
// APLOC2 Week 1
|
||||
//
|
||||
// Created by Brent Marohnic on 2/7/13.
|
||||
// Copyright (c) 2013 Brent Marohnic. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "Child.h"
|
||||
|
||||
@interface RottenChild : Child
|
||||
|
||||
-(void)setAttributes;
|
||||
|
||||
@end
|
|
@ -0,0 +1,19 @@
|
|||
//
|
||||
// RottenChild.m
|
||||
// APLOC2 Week 1
|
||||
//
|
||||
// Created by Brent Marohnic on 2/7/13.
|
||||
// Copyright (c) 2013 Brent Marohnic. All rights reserved.
|
||||
//
|
||||
|
||||
#import "RottenChild.h"
|
||||
#import "Child.h"
|
||||
|
||||
@implementation RottenChild
|
||||
|
||||
-(void)setAttributes
|
||||
{
|
||||
intChild = 3;
|
||||
strName = @"Brent";
|
||||
}
|
||||
@end
|
|
@ -10,6 +10,8 @@
|
|||
#import "Child.h"
|
||||
#import "ChildFactory.h"
|
||||
#import "GoodChild.h"
|
||||
#import "BadChild.h"
|
||||
#import "RottenChild.h"
|
||||
|
||||
@interface ViewController ()
|
||||
|
||||
|
@ -28,6 +30,8 @@
|
|||
[Jack showName];
|
||||
}
|
||||
|
||||
|
||||
//Instantiate instances of the subclasses and set their attributes
|
||||
GoodChild *goodChild = [[GoodChild alloc] init];
|
||||
{
|
||||
if (goodChild != nil)
|
||||
|
@ -36,9 +40,30 @@
|
|||
}
|
||||
}
|
||||
|
||||
BadChild *badChild = [[BadChild alloc] init];
|
||||
{
|
||||
if (badChild != nil)
|
||||
{
|
||||
[badChild setAttributes];
|
||||
}
|
||||
}
|
||||
|
||||
RottenChild *rottenChild = [[RottenChild alloc] init];
|
||||
{
|
||||
if (rottenChild != nil)
|
||||
{
|
||||
[rottenChild setAttributes];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view, typically from a nib.
|
||||
|
||||
//Setup the labels that will hold the static and dynamic values
|
||||
|
||||
firstLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 50)];
|
||||
secondLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 51, 320, 50)];
|
||||
|
||||
|
@ -58,8 +83,14 @@
|
|||
}
|
||||
|
||||
firstLabel.text = @"Good Child";
|
||||
secondLabel.text = goodChild->strName;
|
||||
thirdLabel.text = @"Bad Child";
|
||||
fourthLabel.text = badChild->strName;
|
||||
fifthLabel.text = @"Rotten Child";
|
||||
sixthLabel.text = rottenChild->strName;
|
||||
|
||||
|
||||
//Show the labels
|
||||
|
||||
[self.view addSubview:firstLabel];
|
||||
[self.view addSubview:secondLabel];
|
||||
|
|
Loading…
Reference in New Issue