/// <summary> constructors are where we tell the class how to instantiate a new object using its blueprints. /// so when you create an object from this class (a new Chair), it will look for a constructor to know /// exactly how to make this object. this is where you fill the fields with meaningful data (if necessary). /// you can have more than one constructor as long as they take different parameters. /// </summary> public Chair(chairType type, primaryMaterial material, string colour, string name) { // making sure the values passed in are meaningful; if not, throw an exception if (string.IsNullOrWhiteSpace(type.ToString()) || string.IsNullOrWhiteSpace(material.ToString()) || string.IsNullOrWhiteSpace(colour) || string.IsNullOrWhiteSpace(name)) { throw new ArgumentNullException("To make a new chair you need a type, primary material, and colour."); } else { Type = type; // TODO: finish the code so that all the parameters are set to their respective properties } }
public void DisplayChairAttributes(chairType type) { // you can have methods with the same name - just need different parameters! // this is called overloading }