Looking for objective-c Answers? Try Ask4KnowledgeBase
Looking for objective-c Keywords? Try Ask4Keywords

Objective-C Language Creating classes with initialization values


#import <Foundation/Foundation.h>
@interface Car:NSObject {
    NSString *CarMotorCode;
    NSString *CarChassisCode;

- (instancetype)initWithMotorValue:(NSString *) motorCode andChassisValue:(NSInteger)chassisCode;
- (void) startCar;
- (void) stopCar;


@implementation Car

- (instancetype)initWithMotorValue:(NSString *) motorCode andChassisValue:(NSInteger)chassisCode{
    CarMotorCode = motorCode;
    CarChassisCode = chassisCode;
    return self;

- (void) startCar {...}
- (void) stopCar {...}


The method initWithMotorValue: type andChassisValue: type will be used to initialize the Car objects.