hey guys. i want to develop a project to learn something new. so i created a scenario. i have Two classes(TheDriver and TrafficLights). here the classes.
TheDriver.h
TheDriver.m
TrafficLights.h
TrafficLights.m
i want the driver will push gas pedal when the traffic light is green and if the red light is activated the driver will push break pedal.
i try to make it with delegate but i couldn't achieve. anyone who can help me about this ?
TheDriver.h
Code:
#import <Foundation/Foundation.h>
@interface TheDriver : NSObject
@property (retain, nonatomic) NSString *driverName;
@property (assign, nonatomic) NSInteger drvierAge;
@property (assign, nonatomic) NSInteger driverLicenseCode;
Code:
#import "TheDriver.h"
@implementation TheDriver
@synthesize driverName;
@synthesize driverLicenseCode;
@synthesize drvierAge;
- (id) init
{
self = [super init];
if (self)
{
}
return self;
}
TrafficLights.h
Code:
#import <Foundation/Foundation.h>
@interface TrafficLights : NSObject
- (void) redLineActived;
- (void) greenLineActivated;
TrafficLights.m
Code:
#import "TrafficLights.h"
@implementation TrafficLights
- (void) redLineActived
{
}
- (void) greenLineActivated
{
}
@end
i want the driver will push gas pedal when the traffic light is green and if the red light is activated the driver will push break pedal.
i try to make it with delegate but i couldn't achieve. anyone who can help me about this ?