public Parrot(ParrotTypeEnum type, int numberOfCoconuts, double voltage, bool isNailed) { this.type = type; this.numberOfCoconuts = numberOfCoconuts; this.voltage = voltage; this.isNailed = isNailed; }
public Parrot(ParrotTypeEnum type, int numberOfCoconuts, double voltage, bool isNailed) { _type = ParrotType.NewType(type); _numberOfCoconuts = numberOfCoconuts; _voltage = voltage; _isNailed = isNailed; }
public Parrot(ParrotTypeEnum type, int numberOfCoconuts, double voltage, bool isNailed) { this.m_Type = type; this.m_NumberOfCoconuts = numberOfCoconuts; this.m_Voltage = voltage; this.m_IsNailed = isNailed; }
public static Parrot Create(ParrotTypeEnum type) { if (type == ParrotTypeEnum.EUROPEAN) { return(new EuropeanParrot()); } throw new Exception("More paramaters needed"); }
public static Parrot Create(ParrotTypeEnum type, int numberOfCoconuts, double voltage, bool isNailed, double baseSpeed) { switch (type) { case ParrotTypeEnum.EUROPEAN: return(new EuropeanParrot(numberOfCoconuts, voltage, isNailed, baseSpeed)); case ParrotTypeEnum.AFRICAN: return(new AfricanParrot(numberOfCoconuts, voltage, isNailed, baseSpeed)); case ParrotTypeEnum.NORWEGIAN_BLUE: return(new NorweigenBlue(numberOfCoconuts, voltage, isNailed, baseSpeed)); } return(new Parrot(numberOfCoconuts, voltage, isNailed, baseSpeed)); }
public static Parrot Create(ParrotTypeEnum type, int numberOfCoconuts = 0, double voltage = 0, bool isNailed = false) { switch (type) { case ParrotTypeEnum.EUROPEAN: return(new EuropeanParrot()); case ParrotTypeEnum.NORWEGIAN_BLUE: return(new NorwegianParrot(isNailed, voltage)); case ParrotTypeEnum.AFRICAN: return(new AfricanParrot(numberOfCoconuts)); default: throw new Exception("Unknown parrot type"); } }
public static ParrotType NewType(ParrotTypeEnum typeCode) { switch (typeCode) { case ParrotTypeEnum.EUROPEAN: return(new EuropeanParrot()); case ParrotTypeEnum.AFRICAN: return(new AfricanParrot()); case ParrotTypeEnum.NORWEGIAN_BLUE: return(new NorwegianBlueParrot()); default: throw new ArgumentException("Incorrect parrot code"); } }
public static Parrot Create(ParrotTypeEnum typeEnum, int numberOfCoconuts) { return(new AfricanParrot(numberOfCoconuts)); }
public static Parrot Create(ParrotTypeEnum type, double voltage, bool isNailed) { return(new NorwegianParrot(isNailed, voltage)); }
private Parrot Create(ParrotTypeEnum type, int numberOfCoconuts, double voltage, bool isNailed, double baseSpeed) { return(Parrot.Create(type, numberOfCoconuts, voltage, isNailed, baseSpeed)); }